Package org.springframework.data.convert
Interface PropertyValueConverterFactory
public interface PropertyValueConverterFactory
A factory providing
value converters.
Depending on the applications' need factories can be chained and the resulting converter may be
cached.
- Since:
- 2.7
- Author:
- Christoph Strobl
-
Method Summary
Modifier and TypeMethodDescriptionbeanFactoryAware(BeanFactory beanFactory) Obtain aPropertyValueConverterFactorycapable of looking up/creating thePropertyValueConvertervia the givenBeanFactory.caching(PropertyValueConverterFactory factory) Obtain aPropertyValueConverterFactorythat will cachePropertyValueConverterinstances perPersistentProperty.chained(List<PropertyValueConverterFactory> factoryList) Obtain aPropertyValueConverterFactorythat will try to obtain aPropertyValueConverterfrom the given list offactoriesby returning the first non null one.chained(PropertyValueConverterFactory... factories) Obtain aPropertyValueConverterFactorythat will try to obtain aPropertyValueConverterfrom the given array offactoriesby returning the first non null one.configuredInstance(ValueConverterRegistry<?> registrar) Obtain aPropertyValueConverterFactorycapable of looking up thePropertyValueConverterin the givenPropertyValueConverterRegistrar.<DV,SV, C extends ValueConversionContext<?>>
PropertyValueConverter<DV,SV, C> getConverter(Class<? extends PropertyValueConverter<DV, SV, C>> converterType) Get the converter by its type.default <DV,SV, P extends ValueConversionContext<?>>
PropertyValueConverter<DV,SV, P> getConverter(PersistentProperty<?> property) Get thePropertyValueConverterapplicable for the givenPersistentProperty.simple()Obtain a simplePropertyValueConverterFactorycapable of instantiatingPropertyValueConverterimplementations via their defaultConstructoror in case of anEnumaccessing the first enum value.
-
Method Details
-
getConverter
@Nullable default <DV,SV, PropertyValueConverter<DV,P extends ValueConversionContext<?>> SV, getConverterP> (PersistentProperty<?> property) Get thePropertyValueConverterapplicable for the givenPersistentProperty.- Type Parameters:
DV- domain-specific type.SV- store-native type.P- value conversion context to use.- Parameters:
property- must not be null.- Returns:
- can be null.
-
getConverter
@Nullable <DV,SV, PropertyValueConverter<DV,C extends ValueConversionContext<?>> SV, getConverterC> (Class<? extends PropertyValueConverter<DV, SV, C>> converterType) Get the converter by its type.- Type Parameters:
DV- domain-specific type.SV- store-native type.C- value conversion context to use.- Parameters:
converterType- must not be null.- Returns:
- can be null.
-
simple
Obtain a simplePropertyValueConverterFactorycapable of instantiatingPropertyValueConverterimplementations via their defaultConstructoror in case of anEnumaccessing the first enum value.- Returns:
- new instance of
PropertyValueConverterFactory.
-
beanFactoryAware
Obtain aPropertyValueConverterFactorycapable of looking up/creating thePropertyValueConvertervia the givenBeanFactory.- Parameters:
beanFactory- must not be null.- Returns:
- new instance of
PropertyValueConverterFactory.
-
configuredInstance
Obtain aPropertyValueConverterFactorycapable of looking up thePropertyValueConverterin the givenPropertyValueConverterRegistrar.- Parameters:
registrar- must not be null.- Returns:
- new instance of
PropertyValueConverterFactory.
-
chained
Obtain aPropertyValueConverterFactorythat will try to obtain aPropertyValueConverterfrom the given array offactoriesby returning the first non null one.- Parameters:
factories- must not be null nor contain null values.- Returns:
- new instance of
PropertyValueConverterFactory.
-
chained
Obtain aPropertyValueConverterFactorythat will try to obtain aPropertyValueConverterfrom the given list offactoriesby returning the first non null one.- Parameters:
factoryList- must not be null nor contain null values.- Returns:
- new instance of
PropertyValueConverterFactory.
-
caching
Obtain aPropertyValueConverterFactorythat will cachePropertyValueConverterinstances perPersistentProperty.- Parameters:
factory- must not be null.- Returns:
- new instance of
PropertyValueConverterFactory.
-