Package org.springframework.data.convert
Class PropertyValueConverter.FunctionPropertyValueConverter<DV,SV,P extends PersistentProperty<P>>
java.lang.Object
org.springframework.data.convert.PropertyValueConverter.FunctionPropertyValueConverter<DV,SV,P>
- All Implemented Interfaces:
PropertyValueConverter<DV,SV, ValueConversionContext<P>>
- Enclosing interface:
- PropertyValueConverter<DV,
SV, C extends ValueConversionContext<? extends PersistentProperty<?>>>
public static class PropertyValueConverter.FunctionPropertyValueConverter<DV,SV,P extends PersistentProperty<P>>
extends Object
implements PropertyValueConverter<DV,SV,ValueConversionContext<P>>
A
PropertyValueConverter that delegates conversion to the given BiFunctions.- Author:
- Oliver Drotbohm
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.data.convert.PropertyValueConverter
PropertyValueConverter.FunctionPropertyValueConverter<DV,SV, P extends PersistentProperty<P>>, PropertyValueConverter.ObjectToObjectPropertyValueConverter -
Constructor Summary
ConstructorsConstructorDescriptionFunctionPropertyValueConverter(BiFunction<DV, ValueConversionContext<P>, SV> writer, BiFunction<SV, ValueConversionContext<P>, DV> reader) -
Method Summary
Modifier and TypeMethodDescriptionread(SV value, ValueConversionContext<P> context) Convert the given store specific value into it's domain value representation.readNull(ValueConversionContext<P> context) Convert the givennullvalue from the store into its domain value representation.write(DV value, ValueConversionContext<P> context) Convert the given domain-specific value into it's native store representation.writeNull(ValueConversionContext<P> context) Convert the givennullvalue from the domain model into it's native store representation.
-
Constructor Details
-
FunctionPropertyValueConverter
public FunctionPropertyValueConverter(BiFunction<DV, ValueConversionContext<P>, SV> writer, BiFunction<SV, ValueConversionContext<P>, DV> reader)
-
-
Method Details
-
write
Description copied from interface:PropertyValueConverterConvert the given domain-specific value into it's native store representation. Typically, a write operation.- Specified by:
writein interfacePropertyValueConverter<DV,SV, P extends PersistentProperty<P>> - 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
Description copied from interface:PropertyValueConverterConvert the givennullvalue from the domain model into it's native store representation. Typically, a write operation. Returnsnullby default.- Specified by:
writeNullin interfacePropertyValueConverter<DV,SV, P extends PersistentProperty<P>> - Parameters:
context-ValueConversionContextcontaining store-specific metadata used in the value conversion; never null.- Returns:
- the converted value. Can be null.
-
read
Description copied from interface:PropertyValueConverterConvert the given store specific value into it's domain value representation. Typically, a read operation.- Specified by:
readin interfacePropertyValueConverter<DV,SV, P extends PersistentProperty<P>> - 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
Description copied from interface:PropertyValueConverterConvert the givennullvalue from the store into its domain value representation. Typically, a read operation. Returnsnullby default.- Specified by:
readNullin interfacePropertyValueConverter<DV,SV, P extends PersistentProperty<P>> - Parameters:
context-ValueConversionContextcontaining store-specific metadata used in the value conversion; never null.- Returns:
- the converted value. Can be null.
-