本文整理汇总了Java中org.springframework.core.convert.support.DefaultConversionService.addConverter方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultConversionService.addConverter方法的具体用法?Java DefaultConversionService.addConverter怎么用?Java DefaultConversionService.addConverter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.core.convert.support.DefaultConversionService
的用法示例。
在下文中一共展示了DefaultConversionService.addConverter方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDefaultConversionService
import org.springframework.core.convert.support.DefaultConversionService; //导入方法依赖的package包/类
/**
* Initialize default ConversionService
*
* @return
*/
private ConfigurableConversionService getDefaultConversionService() {
if (this.defaultConversionService == null) {
DefaultConversionService conversionService = new DefaultConversionService();
this.applicationContext.getAutowireCapableBeanFactory().autowireBean(this);
for (Converter<?, ?> converter : this.converters) {
conversionService.addConverter(converter);
}
for (GenericConverter genericConverter : this.genericConverters) {
conversionService.addConverter(genericConverter);
}
this.defaultConversionService = conversionService;
}
return this.defaultConversionService;
}
示例2: getDefaultConversionService
import org.springframework.core.convert.support.DefaultConversionService; //导入方法依赖的package包/类
private ConversionService getDefaultConversionService() {
if (this.defaultConversionService == null) {
DefaultConversionService conversionService = new DefaultConversionService();
this.applicationContext.getAutowireCapableBeanFactory().autowireBean(this);
for (Converter<?, ?> converter : this.converters) {
conversionService.addConverter(converter);
}
for (GenericConverter genericConverter : this.genericConverters) {
conversionService.addConverter(genericConverter);
}
this.defaultConversionService = conversionService;
}
return this.defaultConversionService;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:ConfigurationPropertiesBindingPostProcessor.java
示例3: mongoStoreConverter
import org.springframework.core.convert.support.DefaultConversionService; //导入方法依赖的package包/类
@Bean
public DefaultConversionService mongoStoreConverter() {
DefaultConversionService conversion = new DefaultConversionService();
if (customConverters != null) {
for (Converter<?,String> converter : customConverters) {
conversion.addConverter(converter);
}
}
return conversion;
}
示例4: testDelegatingConversion
import org.springframework.core.convert.support.DefaultConversionService; //导入方法依赖的package包/类
@Test
public void testDelegatingConversion() {
DefaultConversionService conversionService = new DefaultConversionService();
GenericMapConverter mapConverter = new GenericMapConverter(conversionService);
conversionService.addConverter(mapConverter);
TypeDescriptor targetType = TypeDescriptor.map(Map.class, TypeDescriptor.valueOf(Charset.class),
TypeDescriptor.valueOf(UUID.class));
@SuppressWarnings("unchecked")
Map<Charset, UUID> result = (Map<Charset, UUID>) conversionService
.convert("UTF-8 = c46c18c7-b000-44d0-8326-f12ddf423972", targetType);
assertThat(result, hasEntry(Charset.forName("UTF-8"), UUID.fromString("c46c18c7-b000-44d0-8326-f12ddf423972")));
}
示例5: testEscapes
import org.springframework.core.convert.support.DefaultConversionService; //导入方法依赖的package包/类
@Test
public void testEscapes() {
DefaultConversionService conversionService = new DefaultConversionService();
GenericMapConverter mapConverter = new GenericMapConverter(conversionService);
conversionService.addConverter(mapConverter);
TypeDescriptor targetType = TypeDescriptor.map(Map.class, TypeDescriptor.valueOf(String.class),
TypeDescriptor.valueOf(String[].class));
@SuppressWarnings("unchecked")
Map<String, String[]> result = (Map<String, String[]>) conversionService.convert("foo = bar\\,quizz",
targetType);
assertThat(result.values().iterator().next(), Matchers.arrayContaining("bar", "quizz"));
}
示例6: defaultCamelConversionService
import org.springframework.core.convert.support.DefaultConversionService; //导入方法依赖的package包/类
@ConditionalOnMissingBean
@Bean
ConversionService defaultCamelConversionService(ApplicationContext applicationContext) {
DefaultConversionService service = new DefaultConversionService();
for (Converter converter : applicationContext.getBeansOfType(Converter.class).values()) {
service.addConverter(converter);
}
return service;
}
示例7: getDefaultConversionService
import org.springframework.core.convert.support.DefaultConversionService; //导入方法依赖的package包/类
private ConversionService getDefaultConversionService() {
if (this.defaultConversionService == null) {
DefaultConversionService conversionService = new DefaultConversionService();
this.applicationContext.getAutowireCapableBeanFactory().autowireBean(this);
for (Converter<?, ?> converter : this.converters) {
conversionService.addConverter(converter);
}
this.defaultConversionService = conversionService;
}
return this.defaultConversionService;
}
示例8: conversionService
import org.springframework.core.convert.support.DefaultConversionService; //导入方法依赖的package包/类
@Bean
public ConversionService conversionService()
{
DefaultConversionService defaultConversionService = new DefaultConversionService();
defaultConversionService.addConverter(new StringToDateConverter());
defaultConversionService.addConverter(new StringToDateTimeConverter());
return defaultConversionService;
}