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)
Deprecated.
since 2.3, use
PersistentPropertyPathAccessor.getProperty(PersistentPropertyPath) instead |
default Object |
getProperty(PersistentPropertyPath<? extends PersistentProperty<?>> path,
TraversalContext context)
Deprecated.
|
void |
setProperty(PersistentProperty<?> property,
Object value)
Sets the given
PersistentProperty to the given value. |
default void |
setProperty(PersistentPropertyPath<? extends PersistentProperty<?>> path,
Object value)
Deprecated.
since 2.3, use
PersistentPropertyPathAccessor.setProperty(PersistentPropertyPath, Object)
instead. |
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.@Deprecated default void setProperty(PersistentPropertyPath<? extends PersistentProperty<?>> path, @Nullable Object value)
PersistentPropertyPathAccessor.setProperty(PersistentPropertyPath, Object)
instead.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.@Deprecated @Nullable default Object getProperty(PersistentPropertyPath<? extends PersistentProperty<?>> path)
PersistentPropertyPathAccessor.getProperty(PersistentPropertyPath)
insteadPersistentPropertyPath
. If the given path is empty, the wrapped
bean is returned.path
- must not be null.@Nullable @Deprecated default Object getProperty(PersistentPropertyPath<? extends PersistentProperty<?>> path, TraversalContext context)
PersistentPropertyPathAccessor.getProperty(PersistentPropertyPath, org.springframework.data.mapping.AccessOptions.GetOptions)
instead.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–2020 Pivotal Software, Inc.. All rights reserved.