public interface ValueConversionContext<P extends PersistentProperty<P>>
ValueConversionContext
provides access to the store-specific PersistentProperty
and allows to
call the store-default conversion through the read/write methods.
Store implementations should provide their own flavor of ValueConversionContext
enhancing the existing API,
implementing delegates for read(Object, TypeInformation)
, write(Object, TypeInformation)
.
PersistentProperty
Modifier and Type | Method and Description |
---|---|
P |
getProperty()
Return the
PersistentProperty to be handled. |
default Object |
read(Object value)
Reads the value as an instance of the
property type . |
default <T> T |
read(Object value,
Class<T> target)
Reads the value as an instance of
type . |
default <T> T |
read(Object value,
TypeInformation<T> target)
Reads the value as an instance of
type . |
default Object |
write(Object value)
Write the value as an instance of the
property type . |
default <T> T |
write(Object value,
Class<T> target)
Write the value as an instance of
type . |
default <T> T |
write(Object value,
TypeInformation<T> target)
Write the value as an instance of
type . |
P getProperty()
PersistentProperty
to be handled.PersistentProperty
@Nullable default Object write(@Nullable Object value)
property type
.value
- value
to write; can be null.IllegalStateException
- if value cannot be written as an instance of the
property type
.PersistentProperty.getTypeInformation()
,
write(Object, TypeInformation)
@Nullable default <T> T write(@Nullable Object value, @NonNull Class<T> target)
type
.value
- value
to write; can be null.target
- type
of value to be written; must not be null.IllegalStateException
- if value cannot be written as an instance of type
.write(Object, TypeInformation)
,
ClassTypeInformation
@Nullable default <T> T write(@Nullable Object value, @NonNull TypeInformation<T> target)
type
.value
- value
to write; can be null.target
- type
of value to be written; must not be null.IllegalStateException
- if value cannot be written as an instance of type
.TypeInformation
@Nullable default Object read(@Nullable Object value)
property type
.value
- value
to be read; can be null.IllegalStateException
- if value cannot be read as an instance of the
property type
.PersistentProperty.getTypeInformation()
,
read(Object, TypeInformation)
@Nullable default <T> T read(@Nullable Object value, @NonNull Class<T> target)
type
.value
- value
to be read; can be null.target
- type
of value to be read; must not be null.IllegalStateException
- if value cannot be read as an instance of type
.read(Object, TypeInformation)
,
ClassTypeInformation
@Nullable default <T> T read(@Nullable Object value, @NonNull TypeInformation<T> target)
type
.value
- value
to be read; can be null.target
- type
of value to be read; must not be null.IllegalStateException
- if value cannot be read as an instance of type
.TypeInformation
Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.