Package org.datanucleus.api.jdo
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.ExecutionContext
private final Map
<javax.jdo.listener.InstanceLifecycleListener, LifecycleListenerForClass> private List
<LifecycleListenerForClass> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(Object listener, Class[] classes) Adds a new listener to this handler.void
close()
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 void
invokeCallback
(Object pc, String callbackClassName, boolean pcArgument) Method to invoke all listeners for a particular callback.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.void
postAttach
(Object pc, Object detachedPC) Callback after the object is attached.void
Callback after the fields of the object are cleared.void
postCreate
(Object pc) Callback after the object has been created.void
postDelete
(Object pc) Callback after the object is deleted.void
postDetach
(Object pc, Object detachedPC) Callback after the object is detached.void
Callback after the object is made dirty.void
Callback after the fields of the object are loaded.void
postRefresh
(Object pc) Callback after the fields of the object are refreshed.void
Callback after the object is stored.void
Callback before the object is attached.void
Callback before the fields of the object are cleared.void
Callback before the object is deleted.void
Callback before the object is detached.void
Callback before the object is made dirty.void
prePersist
(Object pc) Callback before the object is persisted (just before the lifecycle state change).void
Callback before the object is stored.void
removeListener
(Object listener) Remove a listener for this handler.
-
Field Details
-
ec
org.datanucleus.ExecutionContext ec -
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:
postCreate
in interfaceorg.datanucleus.state.CallbackHandler
- Parameters:
pc
- The Object
-
prePersist
Callback before the object is persisted (just before the lifecycle state change).- Specified by:
prePersist
in interfaceorg.datanucleus.state.CallbackHandler
- Parameters:
pc
- The Object
-
preStore
Callback before the object is stored.- Specified by:
preStore
in interfaceorg.datanucleus.state.CallbackHandler
- Parameters:
pc
- The Object
-
postStore
Callback after the object is stored.- Specified by:
postStore
in interfaceorg.datanucleus.state.CallbackHandler
- Parameters:
pc
- The Object
-
preClear
Callback before the fields of the object are cleared.- Specified by:
preClear
in interfaceorg.datanucleus.state.CallbackHandler
- Parameters:
pc
- The Object
-
postClear
Callback after the fields of the object are cleared.- Specified by:
postClear
in interfaceorg.datanucleus.state.CallbackHandler
- Parameters:
pc
- The Object
-
preDelete
Callback before the object is deleted.- Specified by:
preDelete
in interfaceorg.datanucleus.state.CallbackHandler
- Parameters:
pc
- The Object
-
postDelete
Callback after the object is deleted.- Specified by:
postDelete
in interfaceorg.datanucleus.state.CallbackHandler
- Parameters:
pc
- The Object
-
preDirty
Callback before the object is made dirty.- Specified by:
preDirty
in interfaceorg.datanucleus.state.CallbackHandler
- Parameters:
pc
- The Object
-
postDirty
Callback after the object is made dirty.- Specified by:
postDirty
in interfaceorg.datanucleus.state.CallbackHandler
- Parameters:
pc
- The Object
-
postLoad
Callback after the fields of the object are loaded.- Specified by:
postLoad
in interfaceorg.datanucleus.state.CallbackHandler
- Parameters:
pc
- The Object
-
postRefresh
Callback after the fields of the object are refreshed.- Specified by:
postRefresh
in interfaceorg.datanucleus.state.CallbackHandler
- Parameters:
pc
- The Object
-
preDetach
Callback before the object is detached.- Specified by:
preDetach
in interfaceorg.datanucleus.state.CallbackHandler
- Parameters:
pc
- The Object
-
postDetach
Callback after the object is detached.- Specified by:
postDetach
in interfaceorg.datanucleus.state.CallbackHandler
- Parameters:
pc
- The ObjectdetachedPC
- The detached object
-
preAttach
Callback before the object is attached.- Specified by:
preAttach
in interfaceorg.datanucleus.state.CallbackHandler
- Parameters:
pc
- The Object
-
postAttach
Callback after the object is attached.- Specified by:
postAttach
in interfaceorg.datanucleus.state.CallbackHandler
- Parameters:
pc
- The attached ObjectdetachedPC
- The detached object
-
addListener
Adds a new listener to this handler.- Specified by:
addListener
in interfaceorg.datanucleus.state.CallbackHandler
- Parameters:
listener
- the listener instanceclasses
- the persistent classes which events are fired for the listener
-
removeListener
Remove a listener for this handler.- Specified by:
removeListener
in interfaceorg.datanucleus.state.CallbackHandler
- Parameters:
listener
- the listener instance
-
close
public void close()Clear any objects to release resources.- Specified by:
close
in 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
Method to invoke all listeners for a particular callback.- Parameters:
pc
- The PC object causing the eventpcArgument
- Whether to pass a PC argument to the callbackcallbackClass
- The callback type to call
-
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
-