1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.util.spring.convert;
17
18 import java.io.File;
19
20 import org.kohsuke.MetaInfServices;
21 import org.kuali.common.util.spring.convert.support.PropertiesToXmlStringConverter;
22 import org.kuali.common.util.spring.convert.support.XmlStringToPropertiesConverter;
23 import org.kuali.common.util.spring.format.BytesFormatFactory;
24 import org.kuali.common.util.spring.format.CanonicalFileFormatter;
25 import org.kuali.common.util.spring.format.FileListFormatFactory;
26 import org.kuali.common.util.spring.format.PathListFormatFactory;
27 import org.kuali.common.util.spring.format.TimeFormatFactory;
28 import org.kuali.common.util.spring.format.XmlPropertiesFormatFactory;
29 import org.kuali.common.util.spring.format.optional.OptionalStringFormatFactory;
30 import org.kuali.common.util.spring.format.optional.OptionalTimeZoneFormatFactory;
31 import org.springframework.core.convert.ConversionService;
32 import org.springframework.format.support.DefaultFormattingConversionService;
33
34 @MetaInfServices(ConversionService.class)
35 public class DefaultConversionService extends DefaultFormattingConversionService {
36
37 public DefaultConversionService() {
38 addFormatterForFieldAnnotation(new BytesFormatFactory());
39 addFormatterForFieldAnnotation(new TimeFormatFactory());
40 addFormatterForFieldAnnotation(new OptionalStringFormatFactory());
41 addFormatterForFieldAnnotation(new OptionalTimeZoneFormatFactory());
42 addFormatterForFieldAnnotation(new FileListFormatFactory());
43 addFormatterForFieldAnnotation(new PathListFormatFactory());
44 addFormatterForFieldAnnotation(new XmlPropertiesFormatFactory());
45 addFormatterForFieldType(File.class, new CanonicalFileFormatter());
46 addConverter(new XmlStringToPropertiesConverter());
47 addConverter(new PropertiesToXmlStringConverter());
48 }
49
50 }