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
PersistentPropertys 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 givenPersistentPropertyof the underlying bean instance.voidsetProperty(PersistentProperty<?> property, Object value) Sets the givenPersistentPropertyto the given value.
-
Method Details
-
setProperty
Sets the givenPersistentPropertyto the given value. Will do type conversion if aConversionServiceis 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 givenPersistentPropertyof 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.
-