本文整理匯總了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;
}