Coverage Report - org.kuali.rice.kns.datadictionary.parse.StringMapConverter
 
Classes in this File Line Coverage Branch Coverage Complexity
StringMapConverter
0%
0/6
N/A
1
 
 1  
 /*
 2  
  * Copyright 2007 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 1.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/ecl1.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.kns.datadictionary.parse;
 17  
 
 18  
 import org.kuali.rice.kns.util.KNSUtils;
 19  
 import org.springframework.core.convert.TypeDescriptor;
 20  
 import org.springframework.core.convert.converter.GenericConverter;
 21  
 
 22  
 import java.util.HashSet;
 23  
 import java.util.Map;
 24  
 import java.util.Set;
 25  
 
 26  
 /**
 27  
  * Converts a string configured in the dictionary for a map property type to a Map
 28  
  * object using the convention of commas to separate map entries and a colon to separate
 29  
  * the key value pair
 30  
  *
 31  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 32  
  */
 33  0
 public class StringMapConverter implements GenericConverter {
 34  
 
 35  
     @Override
 36  
     public Set<ConvertiblePair> getConvertibleTypes() {
 37  0
         Set<ConvertiblePair> pairs = new HashSet<ConvertiblePair>();
 38  
 
 39  0
         ConvertiblePair stringMapPair = new ConvertiblePair(String.class, Map.class);
 40  0
         pairs.add(stringMapPair);
 41  
 
 42  0
         return pairs;
 43  
     }
 44  
 
 45  
     @Override
 46  
     public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
 47  0
         return KNSUtils.convertStringParameterToMap((String) source);
 48  
     }
 49  
 }