DV
- domain-specific type.SV
- store-native type.C
- the store specific conversion context
.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.
ValueConversionContext
,
PersistentProperty
Modifier and Type | Interface and Description |
---|---|
static class |
PropertyValueConverter.FunctionPropertyValueConverter<DV,SV,P extends PersistentProperty<P>>
A
PropertyValueConverter that delegates conversion to the given BiFunction s. |
static class |
PropertyValueConverter.ObjectToObjectPropertyValueConverter
No-op
PropertyValueConverter implementation. |
Modifier and Type | Method and Description |
---|---|
DV |
read(SV value,
C context)
Convert the given store specific value into it's domain value representation.
|
default DV |
readNull(C context)
Convert the given
null value from the store into its domain value representation. |
SV |
write(DV value,
C context)
Convert the given domain-specific value into it's native store representation.
|
default SV |
writeNull(C context)
Convert the given
null value from the domain model into it's native store representation. |
@Nullable DV read(SV value, C context)
value
- value to read.context
- ValueConversionContext
containing store-specific metadata
used in the value conversion; never null.@Nullable default DV readNull(C context)
null
value from the store into its domain value representation. Typically, a
read operation. Returns null
by default.context
- ValueConversionContext
containing store-specific metadata
used in the value conversion; never null.@Nullable SV write(DV value, C context)
value
- value to write; can be null.context
- ValueConversionContext
containing store-specific metadata
used in the value conversion; never null.@Nullable default SV writeNull(C context)
null
value from the domain model into it's native store representation. Typically, a
write operation. Returns null
by default.context
- ValueConversionContext
containing store-specific metadata
used in the value conversion; never null.Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.