接口 ConverterRegistry
- 所有已知子接口:
ConfigurableConversionService
public interface ConverterRegistry
For registering converters with a type conversion system.
- 从以下版本开始:
- 3.0
- 作者:
- Keith Donald, Juergen Hoeller, TODAY 2021/3/21 17:55
-
方法概要
修饰符和类型方法说明voidaddConverter(Converter<?, ?> converter) Add a plain converter to this registry.voidaddConverter(GenericConverter converter) Add a generic converter to this registry.<S,T> void addConverter(Class<S> sourceType, Class<T> targetType, Converter<? super S, ? extends T> converter) Add a plain converter to this registry.voidaddConverterFactory(ConverterFactory<?, ?> factory) Add a ranged converter factory to this registry.static voidregisterConverters(Set<?> converters, ConverterRegistry registry) Register the given Converter objects with the given target ConverterRegistry.voidremoveConvertible(Class<?> sourceType, Class<?> targetType) Remove any converters fromsourceTypetotargetType.
-
方法详细资料
-
addConverter
Add a plain converter to this registry. The convertible source/target type pair is derived from the Converter's parameterized types.- 抛出:
IllegalArgumentException- if the parameterized types could not be resolved
-
addConverter
<S,T> void addConverter(Class<S> sourceType, Class<T> targetType, Converter<? super S, ? extends T> converter) Add a plain converter to this registry. The convertible source/target type pair is specified explicitly.Allows for a Converter to be reused for multiple distinct pairs without having to create a Converter class for each pair.
-
addConverter
Add a generic converter to this registry.- 从以下版本开始:
- 4.0
-
addConverterFactory
Add a ranged converter factory to this registry. The convertible source/target type pair is derived from the ConverterFactory's parameterized types.- 抛出:
IllegalArgumentException- if the parameterized types could not be resolved- 从以下版本开始:
- 4.0
-
removeConvertible
Remove any converters fromsourceTypetotargetType.- 参数:
sourceType- the source typetargetType- the target type- 从以下版本开始:
- 4.0
-
registerConverters
Register the given Converter objects with the given target ConverterRegistry.- 参数:
converters- the converter objects: implementingConverter,ConverterFactory, orGenericConverterregistry- the target registry- 从以下版本开始:
- 4.0
-