1
2
3
4
5
6
7
8
9
10
11
12
13
14
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.Map;
24 import java.util.Set;
25
26
27
28
29
30
31
32
33 public class StringMapConverter implements GenericConverter {
34
35 @Override
36 public Set<ConvertiblePair> getConvertibleTypes() {
37 Set<ConvertiblePair> pairs = new HashSet<ConvertiblePair>();
38
39 ConvertiblePair stringMapPair = new ConvertiblePair(String.class, Map.class);
40 pairs.add(stringMapPair);
41
42 return pairs;
43 }
44
45 @Override
46 public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
47 return KRADUtils.convertStringParameterToMap((String) source);
48 }
49 }