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 BiFunction
s.- 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
ConstructorDescriptionFunctionPropertyValueConverter
(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 givennull
value 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 givennull
value 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:PropertyValueConverter
Convert the given domain-specific value into it's native store representation. Typically, a write operation.- Specified by:
write
in interfacePropertyValueConverter<DV,
SV, P extends PersistentProperty<P>> - Parameters:
value
- value to write; can be null.context
-ValueConversionContext
containing store-specific metadata used in the value conversion; never null.- Returns:
- the converted value. Can be null.
-
writeNull
Description copied from interface:PropertyValueConverter
Convert the givennull
value from the domain model into it's native store representation. Typically, a write operation. Returnsnull
by default.- Specified by:
writeNull
in interfacePropertyValueConverter<DV,
SV, P extends PersistentProperty<P>> - Parameters:
context
-ValueConversionContext
containing store-specific metadata used in the value conversion; never null.- Returns:
- the converted value. Can be null.
-
read
Description copied from interface:PropertyValueConverter
Convert the given store specific value into it's domain value representation. Typically, a read operation.- Specified by:
read
in interfacePropertyValueConverter<DV,
SV, P extends PersistentProperty<P>> - Parameters:
value
- value to read.context
-ValueConversionContext
containing store-specific metadata used in the value conversion; never null.- Returns:
- the converted value. Can be null.
-
readNull
Description copied from interface:PropertyValueConverter
Convert the givennull
value from the store into its domain value representation. Typically, a read operation. Returnsnull
by default.- Specified by:
readNull
in interfacePropertyValueConverter<DV,
SV, P extends PersistentProperty<P>> - Parameters:
context
-ValueConversionContext
containing store-specific metadata used in the value conversion; never null.- Returns:
- the converted value. Can be null.
-