View Javadoc
1   /*
2    * Copyright 2018-2022 Medical Information Systems Research Group (https://medical.zcu.cz),
3    * Department of Computer Science and Engineering, University of West Bohemia.
4    * Address: Univerzitni 8, 306 14 Plzen, Czech Republic.
5    *
6    * Author Petr Vcelak (vcelak@kiv.zcu.cz).
7    *
8    * This file is part of MRECore project.
9    *
10   * MRECore is free software: you can redistribute it and/or modify
11   * it under the terms of the GNU General Public License as published by
12   * the Free Software Foundation, either version 3 of the License.
13   *
14   * MRECore is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17   * GNU General Public License for more details.
18   *
19   * You should have received a copy of the GNU General Public License
20   * along with MRECore. If not, see <http://www.gnu.org/licenses/>.
21   */
22  package cz.zcu.mre.converter;
23  
24  import org.springframework.core.convert.converter.ConverterRegistry;
25  import org.springframework.core.convert.support.ConfigurableConversionService;
26  import org.springframework.format.support.DefaultFormattingConversionService;
27  
28  /**
29   * Conversion Service provider.
30   *
31   * @author Petr Vcelak (vcelak@kiv.zcu.cz)
32   */
33  public class ConversionServiceProvider extends DefaultFormattingConversionService implements ConfigurableConversionService {
34  
35      public ConversionServiceProvider() {
36          super();
37  
38          addDefaultConverters(this);
39      }
40  
41      public static void addDefaultConverters(ConverterRegistry converterRegistry) {
42  
43          //converterRegistry.addConverter(new OntClassToStringConverter());
44          //converterRegistry.addConverter(new OntClassImplToStringConverter());
45          converterRegistry.addConverter(new StringToPropertyConverter());
46          //converterRegistry.addConverter(new PropertyToStringConverter());
47  
48          converterRegistry.addConverter(new StringToResourceConverter());
49          //converterRegistry.addConverter(new ResourceToStringConverter());
50  
51          converterRegistry.addConverter(new StringToResourceWrapperConverter());
52  
53          converterRegistry.addConverter(new OntClassImplToStringConverter());
54          converterRegistry.addConverter(new OntClassToStringConverter());
55          converterRegistry.addConverter(new PropertyToStringConverter());
56      }
57  }