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