Class AuditingEntityCallback
java.lang.Object
org.springframework.data.mongodb.core.mapping.event.AuditingEntityCallback
- All Implemented Interfaces:
Ordered, EntityCallback<Object>, BeforeConvertCallback<Object>
public class AuditingEntityCallback
extends Object
implements BeforeConvertCallback<Object>, Ordered
EntityCallback to populate auditing related fields on an entity about to be saved.- Since:
- 2.2
- Author:
- Mark Paluch, HeeChul Yang
-
Field Summary
Fields inherited from interface Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionAuditingEntityCallback(ObjectFactory<IsNewAwareAuditingHandler> auditingHandlerFactory) Creates a newAuditingEntityCallbackusing the givenMappingContextandAuditingHandlerprovided by the givenObjectFactory. -
Method Summary
Modifier and TypeMethodDescriptionintgetOrder()onBeforeConvert(Object entity, String collection) Entity callback method invoked before a domain object is converted to be persisted.voidsetOrder(int order) Specify the order value for thisBeforeConvertCallback.
-
Constructor Details
-
AuditingEntityCallback
Creates a newAuditingEntityCallbackusing the givenMappingContextandAuditingHandlerprovided by the givenObjectFactory.- Parameters:
auditingHandlerFactory- must not be null.
-
-
Method Details
-
getOrder
-
setOrder
public void setOrder(int order) Specify the order value for thisBeforeConvertCallback.The default value is
100.- Since:
- 5.0
- See Also:
-
onBeforeConvert
Description copied from interface:BeforeConvertCallbackEntity callback method invoked before a domain object is converted to be persisted. Can return either the same or a modified instance of the domain object.- Specified by:
onBeforeConvertin interfaceBeforeConvertCallback<Object>- Parameters:
entity- the domain object to save.collection- name of the collection.- Returns:
- the domain object to be persisted.
-