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
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleancontainsConverterFor(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 thePropertyValueConverterregistered for the given type, path combination or null if none defined.booleanisEmpty()Check if converters are registered.voidregisterConverter(Class<?> type, String path, PropertyValueConverter<?, ?, ? extends ValueConversionContext<P>> converter) Register thePropertyValueConverterfor thepropertyof the given type.static <P extends PersistentProperty<P>>
ValueConverterRegistry<P>simple()Obtain a simpleValueConverterRegistry.
-
Method Details
-
registerConverter
void registerConverter(Class<?> type, String path, PropertyValueConverter<?, ?, ? extends ValueConversionContext<P>> converter) Register thePropertyValueConverterfor thepropertyof 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 thePropertyValueConverterregistered for the given type, path combination or null if none defined.- Type Parameters:
DV- domain-specific type.SV- store-specific type.- 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 is present for the given type/path combination.
-
isEmpty
boolean isEmpty()Check if converters are registered. -
simple
Obtain a simpleValueConverterRegistry.- Type Parameters:
P-PersistentPropertytype.- Returns:
- new instance of
ValueConverterRegistry.
-