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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsConverterFor(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 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.voidregisterConverterIfAbsent(Class<?> type, String path, PropertyValueConverter<?, ?, ? extends ValueConversionContext<P>> converter) Register thePropertyValueConverterfor the property of the given type if none had been registered before.intsize()
-
Constructor Details
-
SimplePropertyValueConverterRegistry
public SimplePropertyValueConverterRegistry()
-
-
Method Details
-
registerConverter
public void registerConverter(Class<?> type, String path, PropertyValueConverter<?, ?, ? extends ValueConversionContext<P>> converter) Description copied from interface:ValueConverterRegistryRegister thePropertyValueConverterfor thepropertyof the given type.- Specified by:
registerConverterin 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 thePropertyValueConverterfor 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:ValueConverterRegistryCheck if a converter is registered for the given type, path combination.- Specified by:
containsConverterForin 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 is 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:ValueConverterRegistryObtain thePropertyValueConverterregistered for the given type, path combination or null if none defined.- Specified by:
getConverterin interfaceValueConverterRegistry<P extends PersistentProperty<P>>- Type Parameters:
S- domain-specific type.T- 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.
-
size
public int size()- Returns:
- the number of registered converters.
-
isEmpty
public boolean isEmpty()Description copied from interface:ValueConverterRegistryCheck if converters are registered.- Specified by:
isEmptyin interfaceValueConverterRegistry<P extends PersistentProperty<P>>
-