Class AbstractMapper
- java.lang.Object
-
- org.hibernate.envers.internal.entities.mapper.AbstractMapper
-
- Direct Known Subclasses:
AbstractIdMapper
,AbstractMiddleComponentMapper
,AbstractPropertyMapper
public abstract class AbstractMapper extends Object
A base class for all entity mapper implementations.
-
-
Constructor Summary
Constructors Constructor Description AbstractMapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T> T
doPrivileged(Supplier<T> block)
Perform an action in a privileged block.protected void
getAndSetValue(PropertyData propertyData, Object source, Object destination, ServiceRegistry serviceRegistry)
Gets the value from the source object and sets the value in the destination object.protected <T> T
getValueFromObject(String propertyName, String accessType, Object object, ServiceRegistry serviceRegistry)
Get a value from the specified object.protected <T> T
getValueFromObject(PropertyData propertyData, Object object, ServiceRegistry serviceRegistry)
Get a value from the specified object.protected <T> T
newObjectInstance(Class<T> clazz, Object... args)
Creates a new object based on the specified class with the given constructor arguments.protected void
setValueOnObject(PropertyData propertyData, Object object, Object value, ServiceRegistry serviceRegistry)
Set the specified value on the object.
-
-
-
Method Detail
-
doPrivileged
protected <T> T doPrivileged(Supplier<T> block)
Perform an action in a privileged block.- Type Parameters:
T
- the return type- Parameters:
block
- the lambda to executed in privileged.- Returns:
- the result of the privileged call, may be null
-
getValueFromObject
protected <T> T getValueFromObject(PropertyData propertyData, Object object, ServiceRegistry serviceRegistry)
Get a value from the specified object.- Type Parameters:
T
- the return type- Parameters:
propertyData
- the property data, should not be nullobject
- the object for which the value should be read, should not be nullserviceRegistry
- the service registry, should not be null- Returns:
- the value read from the object, may be null
-
getValueFromObject
protected <T> T getValueFromObject(String propertyName, String accessType, Object object, ServiceRegistry serviceRegistry)
Get a value from the specified object.- Type Parameters:
T
- the return type- Parameters:
propertyName
- the property name, should not be nullaccessType
- the property access type, should not be nullobject
- the object for hwich the value should be read, should not be nullserviceRegistry
- the service registry, should not be null- Returns:
- the value read from the object, may be null
-
setValueOnObject
protected void setValueOnObject(PropertyData propertyData, Object object, Object value, ServiceRegistry serviceRegistry)
Set the specified value on the object.- Parameters:
propertyData
- the property data, should not be nullobject
- the object for which the value should be set, should not be nullvalue
- the value ot be set, may be nullserviceRegistry
- the service registry, should not be null
-
getAndSetValue
protected void getAndSetValue(PropertyData propertyData, Object source, Object destination, ServiceRegistry serviceRegistry)
Gets the value from the source object and sets the value in the destination object.- Parameters:
propertyData
- the property data, should not be nullsource
- the source object, should not be nulldestination
- the destination object, should not be nullserviceRegistry
- the service registry, should not be null
-
newObjectInstance
protected <T> T newObjectInstance(Class<T> clazz, Object... args)
Creates a new object based on the specified class with the given constructor arguments.- Type Parameters:
T
- the return class type- Parameters:
clazz
- the class, must not be nullargs
- the variadic constructor arguments, may be omitted.- Returns:
- a new instance of the class
-
-