Coverage Report - org.kuali.rice.krad.datadictionary.parse.StringListConverter
 
Classes in this File Line Coverage Branch Coverage Complexity
StringListConverter
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.krad.datadictionary.parse;
 17  
 
 18  
 import org.kuali.rice.krad.util.KRADUtils;
 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.List;
 24  
 import java.util.Set;
 25  
 
 26  
 /**
 27  
  * Converts a string configured in the dictionary for a list property type to a List
 28  
  * object using the convention of commas to separate list entries
 29  
  *
 30  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 31  
  */
 32  0
 public class StringListConverter implements GenericConverter {
 33  
 
 34  
     @Override
 35  
     public Set<ConvertiblePair> getConvertibleTypes() {
 36  0
         Set<ConvertiblePair> pairs = new HashSet<ConvertiblePair>();
 37  
 
 38  0
         ConvertiblePair stringListPair = new ConvertiblePair(String.class, List.class);
 39  0
         pairs.add(stringListPair);
 40  
 
 41  0
         return pairs;
 42  
     }
 43  
 
 44  
     @Override
 45  
     public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
 46  0
         return KRADUtils.convertStringParameterToList((String) source);
 47  
     }
 48  
 }