public interface PersistentPropertyAccessor<T>
PersistentProperty
s of an entity. Usually obtained through
PersistentEntity.getPropertyAccessor(Object)
. In case type conversion shall be applied on property access,
use a ConvertingPropertyAccessor
.
This service supports mutation for immutable classes by creating new object instances. These are managed as state of
PersistentPropertyAccessor
and must be obtained from getBean()
after processing all updates.PersistentEntity.getPropertyAccessor(Object)
,
ConvertingPropertyAccessor
Modifier and Type | Method and Description |
---|---|
T |
getBean()
Returns the underlying bean.
|
Object |
getProperty(PersistentProperty<?> property)
Returns the value of the given
PersistentProperty of the underlying bean instance. |
default Object |
getProperty(PersistentPropertyPath<? extends PersistentProperty<?>> path)
Return the value pointed to by the given
PersistentPropertyPath . |
default Object |
getProperty(PersistentPropertyPath<? extends PersistentProperty<?>> path,
TraversalContext context)
Return the value pointed to by the given
PersistentPropertyPath . |
void |
setProperty(PersistentProperty<?> property,
Object value)
Sets the given
PersistentProperty to the given value. |
default void |
setProperty(PersistentPropertyPath<? extends PersistentProperty<?>> path,
Object value)
Sets the given value for the
PersistentProperty pointed to by the given PersistentPropertyPath . |
void setProperty(PersistentProperty<?> property, @Nullable Object value)
PersistentProperty
to the given value. Will do type conversion if a
ConversionService
is configured.property
- must not be null.value
- can be null.MappingException
- in case an exception occurred when setting the property value.default void setProperty(PersistentPropertyPath<? extends PersistentProperty<?>> path, @Nullable Object value)
PersistentProperty
pointed to by the given PersistentPropertyPath
. The
lookup of intermediate values must not yield null.path
- must not be null or empty.value
- can be null.@Nullable Object getProperty(PersistentProperty<?> property)
PersistentProperty
of the underlying bean instance.property
- must not be null.@Nullable default Object getProperty(PersistentPropertyPath<? extends PersistentProperty<?>> path)
PersistentPropertyPath
. If the given path is empty, the wrapped
bean is returned.path
- must not be null.@Nullable default Object getProperty(PersistentPropertyPath<? extends PersistentProperty<?>> path, TraversalContext context)
PersistentPropertyPath
. If the given path is empty, the wrapped
bean is returned. On each path segment value lookup, the resulting value is post-processed by handlers registered
on the given TraversalContext
context. This can be used to unwrap container types that are encountered
during the traversal.path
- must not be null.context
- must not be null.T getBean()
setProperty(PersistentProperty, Object)
calls.Copyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.