public class InstantiationAwarePropertyAccessor<T> extends Object implements PersistentPropertyAccessor<T>
PersistentPropertyAccessor
that will use an entity's PersistenceConstructor
to create a new
instance of it to apply a new value for a given PersistentProperty
. Will only be used if the
PersistentProperty
is to be applied on a completely immutable entity type exposing a persistence constructor.Constructor and Description |
---|
InstantiationAwarePropertyAccessor(PersistentPropertyAccessor<T> delegate,
EntityInstantiators instantiators)
Deprecated.
since 2.4. Using this constructor allows only setting a single property as
PersistentPropertyAccessor holds a reference to the initial bean state. |
InstantiationAwarePropertyAccessor(T bean,
Function<T,PersistentPropertyAccessor<T>> accessorFunction,
EntityInstantiators instantiators)
Creates an
InstantiationAwarePropertyAccessor using the given delegate accessorFunction and
EntityInstantiators . |
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. |
void |
setProperty(PersistentProperty<?> property,
Object value)
Sets the given
PersistentProperty to the given value. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getProperty, getProperty, setProperty
@Deprecated public InstantiationAwarePropertyAccessor(PersistentPropertyAccessor<T> delegate, EntityInstantiators instantiators)
PersistentPropertyAccessor
holds a reference to the initial bean state.InstantiationAwarePropertyAccessor
using the given delegate PersistentPropertyAccessor
and EntityInstantiators
.delegate
- must not be null.instantiators
- must not be null.public InstantiationAwarePropertyAccessor(T bean, Function<T,PersistentPropertyAccessor<T>> accessorFunction, EntityInstantiators instantiators)
InstantiationAwarePropertyAccessor
using the given delegate accessorFunction
and
EntityInstantiators
. accessorFunction
is used to obtain a new PersistentPropertyAccessor
for each property to set.bean
- must not be null.accessorFunction
- must not be null.instantiators
- must not be null.public void setProperty(PersistentProperty<?> property, @Nullable Object value)
PersistentPropertyAccessor
PersistentProperty
to the given value. Will do type conversion if a
ConversionService
is configured.setProperty
in interface PersistentPropertyAccessor<T>
property
- must not be null.value
- can be null.@Nullable public Object getProperty(PersistentProperty<?> property)
PersistentPropertyAccessor
PersistentProperty
of the underlying bean instance.getProperty
in interface PersistentPropertyAccessor<T>
property
- must not be null.public T getBean()
PersistentPropertyAccessor
PersistentPropertyAccessor.setProperty(PersistentProperty, Object)
calls.getBean
in interface PersistentPropertyAccessor<T>
Copyright © 2011–2023 Pivotal Software, Inc.. All rights reserved.