Package org.springframework.data.convert
Interface PropertyValueConverter<DV,SV,C extends ValueConversionContext<? extends PersistentProperty<?>>>
- Type Parameters:
DV- domain-specific type.SV- store-native type.C- the store specificconversion context.
- All Known Implementing Classes:
PropertyValueConverter.FunctionPropertyValueConverter,PropertyValueConverter.ObjectToObjectPropertyValueConverter
public interface PropertyValueConverter<DV,SV,C extends ValueConversionContext<? extends PersistentProperty<?>>>
PropertyValueConverter provides a symmetric way of converting certain properties from domain to
store-specific values.
A PropertyValueConverter is, other than a ReadingConverter or WritingConverter, only applied
to special annotated fields which allows a fine-grained conversion of certain values within a specific context.
Converter methods are called with non-null values only and provide specific hooks for null value handling.
readNull(ValueConversionContext) and writeNull(ValueConversionContext) methods are specifically
designated to either retain null values or return a different value to indicate null values.
- Since:
- 2.7
- Author:
- Christoph Strobl, Mark Paluch
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classAPropertyValueConverterthat delegates conversion to the givenBiFunctions.static enumNo-opPropertyValueConverterimplementation. -
Method Summary
Modifier and TypeMethodDescriptionConvert the given store specific value into it's domain value representation.default DVConvert the givennullvalue from the store into its domain value representation.Convert the given domain-specific value into it's native store representation.default SVConvert the givennullvalue from the domain model into it's native store representation.
-
Method Details
-
read
Convert the given store specific value into it's domain value representation. Typically, a read operation.- Parameters:
value- value to read.context-ValueConversionContextcontaining store-specific metadata used in the value conversion; never null.- Returns:
- the converted value. Can be null.
-
readNull
Convert the givennullvalue from the store into its domain value representation. Typically, a read operation. Returnsnullby default.- Parameters:
context-ValueConversionContextcontaining store-specific metadata used in the value conversion; never null.- Returns:
- the converted value. Can be null.
-
write
Convert the given domain-specific value into it's native store representation. Typically, a write operation.- Parameters:
value- value to write; can be null.context-ValueConversionContextcontaining store-specific metadata used in the value conversion; never null.- Returns:
- the converted value. Can be null.
-
writeNull
Convert the givennullvalue from the domain model into it's native store representation. Typically, a write operation. Returnsnullby default.- Parameters:
context-ValueConversionContextcontaining store-specific metadata used in the value conversion; never null.- Returns:
- the converted value. Can be null.
-