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
(org.springframework.beans.factory.BeanFactory beanFactory) Obtain aPropertyValueConverterFactory
capable of looking up/creating thePropertyValueConverter
via the givenBeanFactory
.caching
(PropertyValueConverterFactory factory) Obtain aPropertyValueConverterFactory
that will cachePropertyValueConverter
instances perPersistentProperty
.chained
(List<PropertyValueConverterFactory> factoryList) Obtain aPropertyValueConverterFactory
that will try to obtain aPropertyValueConverter
from the given list offactories
by returning the first non null one.chained
(PropertyValueConverterFactory... factories) Obtain aPropertyValueConverterFactory
that will try to obtain aPropertyValueConverter
from the given array offactories
by returning the first non null one.configuredInstance
(ValueConverterRegistry<?> registrar) Obtain aPropertyValueConverterFactory
capable of looking up thePropertyValueConverter
in 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 thePropertyValueConverter
applicable for the givenPersistentProperty
.simple()
Obtain a simplePropertyValueConverterFactory
capable of instantiatingPropertyValueConverter
implementations via their defaultConstructor
or in case of anEnum
accessing the first enum value.
-
Method Details
-
getConverter
@Nullable default <DV,SV, PropertyValueConverter<DV,P extends ValueConversionContext<?>> SV, getConverterP> (PersistentProperty<?> property) Get thePropertyValueConverter
applicable 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 simplePropertyValueConverterFactory
capable of instantiatingPropertyValueConverter
implementations via their defaultConstructor
or in case of anEnum
accessing the first enum value.- Returns:
- new instance of
PropertyValueConverterFactory
.
-
beanFactoryAware
static PropertyValueConverterFactory beanFactoryAware(org.springframework.beans.factory.BeanFactory beanFactory) Obtain aPropertyValueConverterFactory
capable of looking up/creating thePropertyValueConverter
via the givenBeanFactory
.- Parameters:
beanFactory
- must not be null.- Returns:
- new instance of
PropertyValueConverterFactory
.
-
configuredInstance
Obtain aPropertyValueConverterFactory
capable of looking up thePropertyValueConverter
in the givenPropertyValueConverterRegistrar
.- Parameters:
registrar
- must not be null.- Returns:
- new instance of
PropertyValueConverterFactory
.
-
chained
Obtain aPropertyValueConverterFactory
that will try to obtain aPropertyValueConverter
from the given array offactories
by returning the first non null one.- Parameters:
factories
- must not be null nor contain null values.- Returns:
- new instance of
PropertyValueConverterFactory
.
-
chained
Obtain aPropertyValueConverterFactory
that will try to obtain aPropertyValueConverter
from the given list offactories
by returning the first non null one.- Parameters:
factoryList
- must not be null nor contain null values.- Returns:
- new instance of
PropertyValueConverterFactory
.
-
caching
Obtain aPropertyValueConverterFactory
that will cachePropertyValueConverter
instances perPersistentProperty
.- Parameters:
factory
- must not be null.- Returns:
- new instance of
PropertyValueConverterFactory
.
-