Package org.springframework.data.convert
Interface ValueConverterRegistry<P extends PersistentProperty<P>>
- All Known Implementing Classes:
SimplePropertyValueConverterRegistry
public interface ValueConverterRegistry<P extends PersistentProperty<P>>
A registry of property-specific
value converters
to convert only specific
properties/values of an object.- Since:
- 2.7
- Author:
- Christoph Strobl
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
containsConverterFor
(Class<?> type, String path) Check if a converter is registered for the given type, path combination.<DV,
SV> PropertyValueConverter<DV, SV, ? 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.static <T extends PersistentProperty<T>>
ValueConverterRegistry<T>simple()
Obtain a simpleValueConverterRegistry
.
-
Method Details
-
registerConverter
void registerConverter(Class<?> type, String path, PropertyValueConverter<?, ?, ? extends ValueConversionContext<P>> converter) Register thePropertyValueConverter
for the property of the given type.- 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.
-
getConverter
@Nullable <DV,SV> PropertyValueConverter<DV,SV, getConverter? extends ValueConversionContext<P>> (Class<?> type, String path) Obtain the converter registered for the given type, path combination or null if none defined.- Type Parameters:
DV
-SV
-- 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.
-
containsConverterFor
Check if a converter is registered for the given type, path combination.- 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.
-
isEmpty
boolean isEmpty()Check if converters are registered. -
simple
Obtain a simpleValueConverterRegistry
.- Type Parameters:
T
-- Returns:
- new instance of
ValueConverterRegistry
.
-