Package org.springframework.data.mapping
Interface PersistentPropertyAccessor<T>
- All Known Subinterfaces:
PersistentPropertyPathAccessor<T>
- All Known Implementing Classes:
ConvertingPropertyAccessor
,InstantiationAwarePropertyAccessor
public interface PersistentPropertyAccessor<T>
Domain service to allow accessing and setting
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.
- Since:
- 1.10
- Author:
- Oliver Gierke, Mark Paluch, Johannes Englmeier
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetBean()
Returns the underlying bean.getProperty
(PersistentProperty<?> property) Returns the value of the givenPersistentProperty
of the underlying bean instance.void
setProperty
(PersistentProperty<?> property, Object value) Sets the givenPersistentProperty
to the given value.
-
Method Details
-
setProperty
Sets the givenPersistentProperty
to the given value. Will do type conversion if aConversionService
is configured.- Parameters:
property
- must not be null.value
- can be null.- Throws:
MappingException
- in case an exception occurred when setting the property value.
-
getProperty
Returns the value of the givenPersistentProperty
of the underlying bean instance.- Parameters:
property
- must not be null.- Returns:
- can be null.
-
getBean
T getBean()Returns the underlying bean. The actual instance may change betweensetProperty(PersistentProperty, Object)
calls.- Returns:
- will never be null.
-