Class AuditingHandlerSupport
java.lang.Object
org.springframework.data.auditing.AuditingHandlerSupport
- Direct Known Subclasses:
AuditingHandler
,ReactiveAuditingHandler
Support class to implement auditing handlers.
- Since:
- 2.4
- Author:
- Oliver Gierke, Christoph Strobl, Mark Paluch
-
Constructor Summary
ConstructorDescriptionAuditingHandlerSupport
(PersistentEntities entities) Creates a newAuditableBeanWrapper
using the givenPersistentEntities
when looking up auditing metadata via reflection. -
Method Summary
Modifier and TypeMethodDescriptionprotected final boolean
isAuditable
(Object source) Returns whether the given source is considered to be auditable in the first place.void
setDateTimeForNow
(boolean dateTimeForNow) Setter do determine ifAuditable.setCreatedDate(TemporalAccessor)
} andAuditable.setLastModifiedDate(TemporalAccessor)
shall be filled with the current Java time.void
setDateTimeProvider
(DateTimeProvider dateTimeProvider) Sets theDateTimeProvider
to be used to determine the dates to be set.void
setModifyOnCreation
(boolean modifyOnCreation) Set this to true if you want to treat entity creation as modification and thus setting the current date as modification date during creation, too.
-
Constructor Details
-
AuditingHandlerSupport
Creates a newAuditableBeanWrapper
using the givenPersistentEntities
when looking up auditing metadata via reflection.- Parameters:
entities
- must not be null.
-
-
Method Details
-
setDateTimeForNow
public void setDateTimeForNow(boolean dateTimeForNow) Setter do determine ifAuditable.setCreatedDate(TemporalAccessor)
} andAuditable.setLastModifiedDate(TemporalAccessor)
shall be filled with the current Java time. Defaults totrue
. One might set this tofalse
to use database features to set entity time.- Parameters:
dateTimeForNow
- the dateTimeForNow to set
-
setModifyOnCreation
public void setModifyOnCreation(boolean modifyOnCreation) Set this to true if you want to treat entity creation as modification and thus setting the current date as modification date during creation, too. Defaults totrue
.- Parameters:
modifyOnCreation
- if modification information shall be set on creation, too
-
setDateTimeProvider
Sets theDateTimeProvider
to be used to determine the dates to be set.- Parameters:
dateTimeProvider
- can be null, defaults toCurrentDateTimeProvider
in that case.
-
isAuditable
Returns whether the given source is considered to be auditable in the first place.- Parameters:
source
- must not be null.- Returns:
- true if the given source considered to be auditable.
-