Class JDOCallbackHandler

java.lang.Object
org.datanucleus.api.jdo.JDOCallbackHandler
All Implemented Interfaces:
org.datanucleus.state.CallbackHandler

public class JDOCallbackHandler extends Object implements org.datanucleus.state.CallbackHandler
CallbackHandler implementation for JDO.
  • Field Details

    • ec

      org.datanucleus.ExecutionContext ec
    • listeners

      private final Map<javax.jdo.listener.InstanceLifecycleListener,LifecycleListenerForClass> listeners
    • listenersWorkingCopy

      private List<LifecycleListenerForClass> listenersWorkingCopy
    • beanValidationHandler

      org.datanucleus.BeanValidationHandler beanValidationHandler
    • allowAnnotatedCallbacks

      boolean allowAnnotatedCallbacks
  • Constructor Details

    • JDOCallbackHandler

      public JDOCallbackHandler(org.datanucleus.ExecutionContext ec)
  • Method Details

    • postCreate

      public void postCreate(Object pc)
      Callback after the object has been created.
      Specified by:
      postCreate in interface org.datanucleus.state.CallbackHandler
      Parameters:
      pc - The Object
    • prePersist

      public void prePersist(Object pc)
      Callback before the object is persisted (just before the lifecycle state change).
      Specified by:
      prePersist in interface org.datanucleus.state.CallbackHandler
      Parameters:
      pc - The Object
    • preStore

      public void preStore(Object pc)
      Callback before the object is stored.
      Specified by:
      preStore in interface org.datanucleus.state.CallbackHandler
      Parameters:
      pc - The Object
    • postStore

      public void postStore(Object pc)
      Callback after the object is stored.
      Specified by:
      postStore in interface org.datanucleus.state.CallbackHandler
      Parameters:
      pc - The Object
    • preClear

      public void preClear(Object pc)
      Callback before the fields of the object are cleared.
      Specified by:
      preClear in interface org.datanucleus.state.CallbackHandler
      Parameters:
      pc - The Object
    • postClear

      public void postClear(Object pc)
      Callback after the fields of the object are cleared.
      Specified by:
      postClear in interface org.datanucleus.state.CallbackHandler
      Parameters:
      pc - The Object
    • preDelete

      public void preDelete(Object pc)
      Callback before the object is deleted.
      Specified by:
      preDelete in interface org.datanucleus.state.CallbackHandler
      Parameters:
      pc - The Object
    • postDelete

      public void postDelete(Object pc)
      Callback after the object is deleted.
      Specified by:
      postDelete in interface org.datanucleus.state.CallbackHandler
      Parameters:
      pc - The Object
    • preDirty

      public void preDirty(Object pc)
      Callback before the object is made dirty.
      Specified by:
      preDirty in interface org.datanucleus.state.CallbackHandler
      Parameters:
      pc - The Object
    • postDirty

      public void postDirty(Object pc)
      Callback after the object is made dirty.
      Specified by:
      postDirty in interface org.datanucleus.state.CallbackHandler
      Parameters:
      pc - The Object
    • postLoad

      public void postLoad(Object pc)
      Callback after the fields of the object are loaded.
      Specified by:
      postLoad in interface org.datanucleus.state.CallbackHandler
      Parameters:
      pc - The Object
    • postRefresh

      public void postRefresh(Object pc)
      Callback after the fields of the object are refreshed.
      Specified by:
      postRefresh in interface org.datanucleus.state.CallbackHandler
      Parameters:
      pc - The Object
    • preDetach

      public void preDetach(Object pc)
      Callback before the object is detached.
      Specified by:
      preDetach in interface org.datanucleus.state.CallbackHandler
      Parameters:
      pc - The Object
    • postDetach

      public void postDetach(Object pc, Object detachedPC)
      Callback after the object is detached.
      Specified by:
      postDetach in interface org.datanucleus.state.CallbackHandler
      Parameters:
      pc - The Object
      detachedPC - The detached object
    • preAttach

      public void preAttach(Object pc)
      Callback before the object is attached.
      Specified by:
      preAttach in interface org.datanucleus.state.CallbackHandler
      Parameters:
      pc - The Object
    • postAttach

      public void postAttach(Object pc, Object detachedPC)
      Callback after the object is attached.
      Specified by:
      postAttach in interface org.datanucleus.state.CallbackHandler
      Parameters:
      pc - The attached Object
      detachedPC - The detached object
    • addListener

      public void addListener(Object listener, Class[] classes)
      Adds a new listener to this handler.
      Specified by:
      addListener in interface org.datanucleus.state.CallbackHandler
      Parameters:
      listener - the listener instance
      classes - the persistent classes which events are fired for the listener
    • removeListener

      public void removeListener(Object listener)
      Remove a listener for this handler.
      Specified by:
      removeListener in interface org.datanucleus.state.CallbackHandler
      Parameters:
      listener - the listener instance
    • close

      public void close()
      Clear any objects to release resources.
      Specified by:
      close in interface org.datanucleus.state.CallbackHandler
    • getListenersWorkingCopy

      protected List<LifecycleListenerForClass> getListenersWorkingCopy()
      Accessor for the working copy of the listeners (in case any are added/removed in the callbacks).
      Returns:
      The working copy
    • invokeCallback

      private void invokeCallback(Object pc, String callbackClassName, boolean pcArgument)
      Method to invoke all listeners for a particular callback.
      Parameters:
      pc - The PC object causing the event
      pcArgument - Whether to pass a PC argument to the callback
      callbackClass - 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 prefixed
      pcArgument - Whether to pass a PC argument to the callback
      listener - Listener object