Package org.springframework.data.convert
Class SimplePropertyValueConversions
java.lang.Object
org.springframework.data.convert.SimplePropertyValueConversions
- All Implemented Interfaces:
- InitializingBean,- PropertyValueConversions
public class SimplePropertyValueConversions
extends Object
implements PropertyValueConversions, InitializingBean
PropertyValueConversions implementation allowing a PropertyValueConverterFactory creating
 converters to be chosen. Activating caching
 allows converters to be reused.
 
 Providing a SimplePropertyValueConverterRegistry adds path configured converter instances.
 
 This class should be initialized. If not, init() will be called on the first
 attempt of converter retrieval.
- Since:
- 2.7
- Author:
- Christoph Strobl, Mark Paluch
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidInitializes thisSimplePropertyValueConversionsinstance.Returns the configuredPropertyValueConverterFactoryresponsible for creating the actualPropertyValueConverter.<DV,SV, P extends PersistentProperty<P>, D extends ValueConversionContext<P>> 
 PropertyValueConverter<DV,SV, D> getValueConverter(P property) Get theValueConverterRegistryused for path configured converters.booleanhasValueConverter(PersistentProperty<?> property) Determines whether aPropertyValueConverterhas been registered for the givenproperty.voidinit()May be called just once to initialize the underlying factory with its values.voidsetConverterCacheEnabled(boolean converterCacheEnabled) Configure whether to use converter the cache.voidsetConverterFactory(PropertyValueConverterFactory converterFactory) Set thePropertyValueConverterFactoryresponsible for creating the actualPropertyValueConverter.voidsetValueConverterRegistry(ValueConverterRegistry<?> valueConverterRegistry) Set theconverter registryused for path configured converters.
- 
Constructor Details- 
SimplePropertyValueConversionspublic SimplePropertyValueConversions()
 
- 
- 
Method Details- 
setConverterFactorySet thePropertyValueConverterFactoryresponsible for creating the actualPropertyValueConverter.- Parameters:
- converterFactory-- PropertyValueConverterFactoryused to create the actual- PropertyValueConverter.
- See Also:
 
- 
getConverterFactoryReturns the configuredPropertyValueConverterFactoryresponsible for creating the actualPropertyValueConverter.- Returns:
- the configured PropertyValueConverterFactory; can be null.
- See Also:
 
- 
setValueConverterRegistrySet theconverter registryused for path configured converters.This is short for adding a PropertyValueConverterFactories.ConfiguredInstanceServingValueConverterFactoryat the end of aPropertyValueConverterFactories.ChainedPropertyValueConverterFactory.- Parameters:
- valueConverterRegistry- registry of- PropertyValueConverters.
- See Also:
 
- 
getValueConverterRegistryGet theValueConverterRegistryused for path configured converters.- Returns:
- the configured ValueConverterRegistry; can be null.
- See Also:
 
- 
setConverterCacheEnabledpublic void setConverterCacheEnabled(boolean converterCacheEnabled) Configure whether to use converter the cache. Enabled by default.- Parameters:
- converterCacheEnabled- set to true to enable caching of- converterinstances.
 
- 
hasValueConverterDetermines whether aPropertyValueConverterhas been registered for the givenproperty.- Specified by:
- hasValueConverterin interface- PropertyValueConversions
- Parameters:
- property-- PersistentPropertyto evaluate.
- Returns:
- true if a PropertyValueConverterhas been registered for the givenproperty.
- See Also:
 
- 
getValueConverterpublic <DV,SV, PropertyValueConverter<DV,P extends PersistentProperty<P>, D extends ValueConversionContext<P>> SV, getValueConverterD> (P property) Description copied from interface:PropertyValueConversions- Specified by:
- getValueConverterin interface- PropertyValueConversions
- Type Parameters:
- DV- domain-specific type
- SV- store-native type
- P- conversion context type
- Parameters:
- property-- PersistentPropertyused to look up the registered- PropertyValueConverter; must not be null.
- Returns:
- the PropertyValueConverterregistered for the givenPersistentProperty; never null.
- See Also:
 
- 
initpublic void init()May be called just once to initialize the underlying factory with its values.
- 
afterPropertiesSetpublic void afterPropertiesSet()Initializes thisSimplePropertyValueConversionsinstance.- Specified by:
- afterPropertiesSetin interface- InitializingBean
- See Also:
 
 
-