本文整理汇总了Java中org.springframework.core.convert.support.GenericConversionService.addConverterFactory方法的典型用法代码示例。如果您正苦于以下问题:Java GenericConversionService.addConverterFactory方法的具体用法?Java GenericConversionService.addConverterFactory怎么用?Java GenericConversionService.addConverterFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.core.convert.support.GenericConversionService
的用法示例。
在下文中一共展示了GenericConversionService.addConverterFactory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerConvertersIn
import org.springframework.core.convert.support.GenericConversionService; //导入方法依赖的package包/类
/**
* Register custom converters within given {@link org.springframework.core.convert.support.GenericConversionService}
*
* @param conversionService must not be null
*/
public void registerConvertersIn(GenericConversionService conversionService) {
Assert.notNull(conversionService);
for (Object converter : converters) {
if (converter instanceof Converter) {
conversionService.addConverter((Converter<?, ?>) converter);
} else if (converter instanceof ConverterFactory) {
conversionService.addConverterFactory((ConverterFactory<?, ?>) converter);
} else if (converter instanceof GenericConverter) {
conversionService.addConverter((GenericConverter) converter);
} else {
throw new IllegalArgumentException("Given object '" + converter
+ "' expected to be a Converter, ConverterFactory or GenericeConverter!");
}
}
}
示例2: registerConvertersIn
import org.springframework.core.convert.support.GenericConversionService; //导入方法依赖的package包/类
/**
* Populates the given {@link GenericConversionService} with the converters registered.
*
* @param conversionService the service to register.
*/
public void registerConvertersIn(final GenericConversionService conversionService) {
for (Object converter : converters) {
boolean added = false;
if (converter instanceof Converter) {
conversionService.addConverter((Converter<?, ?>) converter);
added = true;
}
if (converter instanceof ConverterFactory) {
conversionService.addConverterFactory((ConverterFactory<?, ?>) converter);
added = true;
}
if (converter instanceof GenericConverter) {
conversionService.addConverter((GenericConverter) converter);
added = true;
}
if (!added) {
throw new IllegalArgumentException("Given set contains element that is neither Converter nor ConverterFactory!");
}
}
}
示例3: registerConvertersIn
import org.springframework.core.convert.support.GenericConversionService; //导入方法依赖的package包/类
/**
* Register custom converters within given {@link GenericConversionService}
*
* @param conversionService must not be null
*/
public void registerConvertersIn(GenericConversionService conversionService) {
Assert.notNull(conversionService);
for (Object converter : converters) {
if (converter instanceof Converter) {
conversionService.addConverter((Converter<?, ?>) converter);
} else if (converter instanceof ConverterFactory) {
conversionService.addConverterFactory((ConverterFactory<?, ?>) converter);
} else if (converter instanceof GenericConverter) {
conversionService.addConverter((GenericConverter) converter);
} else {
throw new IllegalArgumentException("Given object '" + converter
+ "' expected to be a Converter, ConverterFactory or GenericeConverter!");
}
}
}
示例4: registerConvertersIn
import org.springframework.core.convert.support.GenericConversionService; //导入方法依赖的package包/类
/**
* Populates the given {@link GenericConversionService} with the convertes registered.
*
* @param conversionService
*/
public void registerConvertersIn(GenericConversionService conversionService) {
for (Object converter : converters) {
boolean added = false;
if (converter instanceof Converter) {
conversionService.addConverter((Converter<?, ?>) converter);
added = true;
}
if (converter instanceof ConverterFactory) {
conversionService.addConverterFactory((ConverterFactory<?, ?>) converter);
added = true;
}
if (converter instanceof GenericConverter) {
conversionService.addConverter((GenericConverter) converter);
added = true;
}
if (!added) {
throw new IllegalArgumentException(
"Given set contains element that is neither Converter nor ConverterFactory!");
}
}
}