当前位置: 首页>>代码示例>>Java>>正文


Java DefaultConversionService.addConverter方法代码示例

本文整理汇总了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;
}
 
开发者ID:zouzhirong,项目名称:configx,代码行数:20,代码来源:ConfigPropertyResolver.java

示例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;
}
 
开发者ID:paulcwarren,项目名称:spring-content,代码行数:11,代码来源:MongoStoreConfiguration.java

示例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")));
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:15,代码来源:GenericMapConverterTests.java

示例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"));

}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:16,代码来源:GenericMapConverterTests.java

示例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;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:10,代码来源:TypeConversionConfiguration.java

示例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;
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:12,代码来源:ConfigurationPropertiesBindingPostProcessor.java

示例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;
}
 
开发者ID:molgenis,项目名称:molgenis,代码行数:9,代码来源:PlatformITConfig.java


注:本文中的org.springframework.core.convert.support.DefaultConversionService.addConverter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。