public class SimplePropertyValueConversions extends Object implements PropertyValueConversions, InitializingBean
PropertyValueConversions
implementation allowing a PropertyValueConverterFactory
creating
converters
to be chosen. Activating cahing
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.
PropertyValueConversions
,
InitializingBean
Constructor and Description |
---|
SimplePropertyValueConversions() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Initializes this
SimplePropertyValueConversions instance. |
PropertyValueConverterFactory |
getConverterFactory()
Returns the configured
PropertyValueConverterFactory responsible for creating the actual
PropertyValueConverter . |
<DV,SV,P extends PersistentProperty<P>,D extends ValueConversionContext<P>> |
getValueConverter(P property)
|
ValueConverterRegistry<?> |
getValueConverterRegistry()
Get the
ValueConverterRegistry used for path configured converters. |
boolean |
hasValueConverter(PersistentProperty<?> property)
Determines whether a
PropertyValueConverter has been registered for
the given property . |
void |
init()
May be called just once to initialize the underlying factory with its values.
|
void |
setConverterCacheEnabled(boolean converterCacheEnabled)
Configure whether to use converter the cache.
|
void |
setConverterFactory(PropertyValueConverterFactory converterFactory)
Set the
PropertyValueConverterFactory responsible for creating the actual PropertyValueConverter . |
void |
setValueConverterRegistry(ValueConverterRegistry<?> valueConverterRegistry)
Set the
converter registry used for path configured converters. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
simple
public void setConverterFactory(@Nullable PropertyValueConverterFactory converterFactory)
PropertyValueConverterFactory
responsible for creating the actual PropertyValueConverter
.converterFactory
- PropertyValueConverterFactory
used to create the actual
PropertyValueConverter
.PropertyValueConverterFactory
@Nullable public PropertyValueConverterFactory getConverterFactory()
PropertyValueConverterFactory
responsible for creating the actual
PropertyValueConverter
.PropertyValueConverterFactory
; can be null.PropertyValueConverterFactory
public void setValueConverterRegistry(@Nullable ValueConverterRegistry<?> valueConverterRegistry)
converter registry
used for path configured converters.
This is short for adding a
PropertyValueConverterFactories.ConfiguredInstanceServingValueConverterFactory
at the end of a PropertyValueConverterFactories.ChainedPropertyValueConverterFactory
.
valueConverterRegistry
- registry of PropertyValueConverters
.ValueConverterRegistry
@Nullable public ValueConverterRegistry<?> getValueConverterRegistry()
ValueConverterRegistry
used for path configured converters.ValueConverterRegistry
; can be null.ValueConverterRegistry
public void setConverterCacheEnabled(boolean converterCacheEnabled)
converterCacheEnabled
- set to true to enable caching of
converter
instances.public boolean hasValueConverter(PersistentProperty<?> property)
PropertyValueConverter
has been registered for
the given property
.hasValueConverter
in interface PropertyValueConversions
property
- PersistentProperty
to evaluate.PropertyValueConverter
has been registered for
the given property
.PersistentProperty
@NonNull public <DV,SV,P extends PersistentProperty<P>,D extends ValueConversionContext<P>> PropertyValueConverter<DV,SV,D> getValueConverter(P property)
PropertyValueConversions
getValueConverter
in interface PropertyValueConversions
DV
- domain-specific typeSV
- store-native typeP
- conversion context typeproperty
- PersistentProperty
used to look up the registered PropertyValueConverter
;
must not be null.PropertyValueConverter
registered for the given PersistentProperty
;
never null.PropertyValueConversions.hasValueConverter(PersistentProperty)
,
PropertyValueConverter
,
PersistentProperty
public void init()
public void afterPropertiesSet()
SimplePropertyValueConversions
instance.afterPropertiesSet
in interface InitializingBean
init()
Copyright © 2011–2023 Pivotal Software, Inc.. All rights reserved.