Class JDOCallbackHandler
java.lang.Object
org.datanucleus.api.jdo.JDOCallbackHandler
- All Implemented Interfaces:
org.datanucleus.state.CallbackHandler
CallbackHandler implementation for JDO.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) boolean(package private) org.datanucleus.BeanValidationHandler(package private) org.datanucleus.ExecutionContextprivate final Map<javax.jdo.listener.InstanceLifecycleListener, LifecycleListenerForClass> private List<LifecycleListenerForClass> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(Object listener, Class[] classes) Adds a new listener to this handler.voidclose()Clear any objects to release resources.protected List<LifecycleListenerForClass> Accessor for the working copy of the listeners (in case any are added/removed in the callbacks).private voidinvokeCallback(Object pc, String callbackClassName, boolean pcArgument) Method to invoke all listeners for a particular callback.private voidinvokeCallbackMethod(Object pc, String methodName, org.datanucleus.ClassLoaderResolver clr, boolean pcArgument) Method to invoke a method of a listener where the Entity is the listener.voidpostAttach(Object pc, Object detachedPC) Callback after the object is attached.voidCallback after the fields of the object are cleared.voidpostCreate(Object pc) Callback after the object has been created.voidpostDelete(Object pc) Callback after the object is deleted.voidpostDetach(Object pc, Object detachedPC) Callback after the object is detached.voidCallback after the object is made dirty.voidCallback after the fields of the object are loaded.voidpostRefresh(Object pc) Callback after the fields of the object are refreshed.voidCallback after the object is stored.voidCallback before the object is attached.voidCallback before the fields of the object are cleared.voidCallback before the object is deleted.voidCallback before the object is detached.voidCallback before the object is made dirty.voidprePersist(Object pc) Callback before the object is persisted (just before the lifecycle state change).voidCallback before the object is stored.voidremoveListener(Object listener) Remove a listener for this handler.
-
Field Details
-
ec
org.datanucleus.ExecutionContext ec -
listeners
private final Map<javax.jdo.listener.InstanceLifecycleListener, LifecycleListenerForClass> listeners -
listenersWorkingCopy
-
beanValidationHandler
org.datanucleus.BeanValidationHandler beanValidationHandler -
allowAnnotatedCallbacks
boolean allowAnnotatedCallbacks
-
-
Constructor Details
-
JDOCallbackHandler
public JDOCallbackHandler(org.datanucleus.ExecutionContext ec)
-
-
Method Details
-
postCreate
Callback after the object has been created.- Specified by:
postCreatein interfaceorg.datanucleus.state.CallbackHandler- Parameters:
pc- The Object
-
prePersist
Callback before the object is persisted (just before the lifecycle state change).- Specified by:
prePersistin interfaceorg.datanucleus.state.CallbackHandler- Parameters:
pc- The Object
-
preStore
Callback before the object is stored.- Specified by:
preStorein interfaceorg.datanucleus.state.CallbackHandler- Parameters:
pc- The Object
-
postStore
Callback after the object is stored.- Specified by:
postStorein interfaceorg.datanucleus.state.CallbackHandler- Parameters:
pc- The Object
-
preClear
Callback before the fields of the object are cleared.- Specified by:
preClearin interfaceorg.datanucleus.state.CallbackHandler- Parameters:
pc- The Object
-
postClear
Callback after the fields of the object are cleared.- Specified by:
postClearin interfaceorg.datanucleus.state.CallbackHandler- Parameters:
pc- The Object
-
preDelete
Callback before the object is deleted.- Specified by:
preDeletein interfaceorg.datanucleus.state.CallbackHandler- Parameters:
pc- The Object
-
postDelete
Callback after the object is deleted.- Specified by:
postDeletein interfaceorg.datanucleus.state.CallbackHandler- Parameters:
pc- The Object
-
preDirty
Callback before the object is made dirty.- Specified by:
preDirtyin interfaceorg.datanucleus.state.CallbackHandler- Parameters:
pc- The Object
-
postDirty
Callback after the object is made dirty.- Specified by:
postDirtyin interfaceorg.datanucleus.state.CallbackHandler- Parameters:
pc- The Object
-
postLoad
Callback after the fields of the object are loaded.- Specified by:
postLoadin interfaceorg.datanucleus.state.CallbackHandler- Parameters:
pc- The Object
-
postRefresh
Callback after the fields of the object are refreshed.- Specified by:
postRefreshin interfaceorg.datanucleus.state.CallbackHandler- Parameters:
pc- The Object
-
preDetach
Callback before the object is detached.- Specified by:
preDetachin interfaceorg.datanucleus.state.CallbackHandler- Parameters:
pc- The Object
-
postDetach
-
preAttach
Callback before the object is attached.- Specified by:
preAttachin interfaceorg.datanucleus.state.CallbackHandler- Parameters:
pc- The Object
-
postAttach
-
addListener
-
removeListener
Remove a listener for this handler.- Specified by:
removeListenerin interfaceorg.datanucleus.state.CallbackHandler- Parameters:
listener- the listener instance
-
close
public void close()Clear any objects to release resources.- Specified by:
closein interfaceorg.datanucleus.state.CallbackHandler
-
getListenersWorkingCopy
Accessor for the working copy of the listeners (in case any are added/removed in the callbacks).- Returns:
- The working copy
-
invokeCallback
-
invokeCallbackMethod
private void invokeCallbackMethod(Object pc, String methodName, org.datanucleus.ClassLoaderResolver clr, boolean pcArgument) Method to invoke a method of a listener where the Entity is the listener. Means that the method invoked takes no arguments as input.- Parameters:
methodName- The method name, including the class name prefixedpcArgument- Whether to pass a PC argument to the callbacklistener- Listener object
-