Package org.springframework.data.convert
Class SimplePropertyValueConverterRegistry<P extends PersistentProperty<P>>
java.lang.Object
org.springframework.data.convert.SimplePropertyValueConverterRegistry<P>
- Type Parameters:
P
- persistent property type.
- All Implemented Interfaces:
ValueConverterRegistry<P>
public class SimplePropertyValueConverterRegistry<P extends PersistentProperty<P>>
extends Object
implements ValueConverterRegistry<P>
A registry of property specific
value convertes
that may be used to convert only
specific properties/values of an object.- Since:
- 2.7
- Author:
- Christoph Strobl
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
containsConverterFor
(Class<?> type, String path) Check if a converter is registered for the given type, path combination.<S,
T> PropertyValueConverter<S, T, ? extends ValueConversionContext<P>> getConverter
(Class<?> type, String path) Obtain the converter registered for the given type, path combination or null if none defined.boolean
isEmpty()
Check if converters are registered.void
registerConverter
(Class<?> type, String path, PropertyValueConverter<?, ?, ? extends ValueConversionContext<P>> converter) Register thePropertyValueConverter
for the property of the given type.void
registerConverterIfAbsent
(Class<?> type, String path, PropertyValueConverter<?, ?, ? extends ValueConversionContext<P>> converter) Register thePropertyValueConverter
for the property of the given type if none had been registered before.int
size()
-
Constructor Details
-
SimplePropertyValueConverterRegistry
public SimplePropertyValueConverterRegistry()
-
-
Method Details
-
registerConverter
public void registerConverter(Class<?> type, String path, PropertyValueConverter<?, ?, ? extends ValueConversionContext<P>> converter) Description copied from interface:ValueConverterRegistry
Register thePropertyValueConverter
for the property of the given type.- Specified by:
registerConverter
in interfaceValueConverterRegistry<P extends PersistentProperty<P>>
- Parameters:
type
- the target type. Must not be null.path
- the property name. Must not be null.converter
- the converter to register. Must not be null.
-
registerConverterIfAbsent
public void registerConverterIfAbsent(Class<?> type, String path, PropertyValueConverter<?, ?, ? extends ValueConversionContext<P>> converter) Register thePropertyValueConverter
for the property of the given type if none had been registered before.- Parameters:
type
- the target type.path
- the property name.converter
- the converter to register.
-
containsConverterFor
Description copied from interface:ValueConverterRegistry
Check if a converter is registered for the given type, path combination.- Specified by:
containsConverterFor
in interfaceValueConverterRegistry<P extends PersistentProperty<P>>
- Parameters:
type
- the target type. Must not be null.path
- the property name. Must not be null.- Returns:
- false if no converter present for the given type/path combination.
-
getConverter
public <S,T> PropertyValueConverter<S,T, getConverter? extends ValueConversionContext<P>> (Class<?> type, String path) Description copied from interface:ValueConverterRegistry
Obtain the converter registered for the given type, path combination or null if none defined.- Specified by:
getConverter
in interfaceValueConverterRegistry<P extends PersistentProperty<P>>
- Parameters:
type
- the target type. Must not be null.path
- the property name. Must not be null.- Returns:
- null if no converter present for the given type/path combination.
-
size
public int size()- Returns:
- the number of registered converters.
-
isEmpty
public boolean isEmpty()Description copied from interface:ValueConverterRegistry
Check if converters are registered.- Specified by:
isEmpty
in interfaceValueConverterRegistry<P extends PersistentProperty<P>>
-