Coverage Report - org.kuali.rice.core.util.jaxb.AttributeSetAdapter
 
Classes in this File Line Coverage Branch Coverage Complexity
AttributeSetAdapter
0%
0/13
0%
0/10
4.5
 
 1  
 /*
 2  
  * Copyright 2007-2010 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.core.util.jaxb;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.List;
 20  
 import java.util.Map;
 21  
 
 22  
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 23  
 
 24  
 import org.kuali.rice.core.util.AttributeSet;
 25  
 
 26  
 /**
 27  
  * This class allows for a {@link org.kuali.rice.core.util.AttributeSet} instance to be passed across the wire by jaxws enabled services
 28  
  * 
 29  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 30  
  *
 31  
  */
 32  0
 public class AttributeSetAdapter extends XmlAdapter<StringMapEntryList, AttributeSet> {
 33  
 
 34  
         /**
 35  
          * @see org.kuali.rice.core.util.jaxb.MapStringStringAdapter#marshal(java.lang.Object)
 36  
          */
 37  
         @Override
 38  
         public StringMapEntryList marshal(AttributeSet attributeSet) throws Exception {
 39  0
                 if (attributeSet == null) {
 40  0
                         return null;
 41  
                 }
 42  0
                 List<StringMapEntry> entries = new ArrayList<StringMapEntry>(attributeSet.size());
 43  0
                 for (Map.Entry<String, String> entry : attributeSet.entrySet()) {
 44  0
                         entries.add(new StringMapEntry(entry));
 45  
                 }
 46  0
                 return new StringMapEntryList(entries);
 47  
         }
 48  
 
 49  
         /**
 50  
          * @see org.kuali.rice.core.util.jaxb.MapStringStringAdapter#unmarshal(java.util.ArrayList)
 51  
          */
 52  
         @Override
 53  
         public AttributeSet unmarshal(StringMapEntryList entries) throws Exception {
 54  0
                 if (entries == null || entries.getEntries() == null) {
 55  0
                         return null;
 56  
                 }
 57  0
                 AttributeSet resultMap = new AttributeSet(entries.getEntries().size());
 58  0
                 for (StringMapEntry entry : entries.getEntries()) {
 59  0
                         resultMap.put(entry.getKey(), entry.getValue());
 60  
                 }
 61  0
                 return resultMap;
 62  
         }
 63  
 
 64  
 }