Class EntityListener<T>

  • All Implemented Interfaces:
    EventListener, org.eclipse.persistence.descriptors.DescriptorEventListener
    Direct Known Subclasses:
    EntityClassListener

    public class EntityListener<T>
    extends org.eclipse.persistence.descriptors.DescriptorEventAdapter
    An EntityListener is placed on the owning entity's descriptor. Callback methods from an EntityListener require a signature on the method. Namely, they must have an Object parameter.
    Since:
    Eclipselink 1.0
    Author:
    Guy Pelletier
    • Constructor Detail

      • EntityListener

        protected EntityListener​(Class<?> entityClass)
        INTERNAL:
      • EntityListener

        public EntityListener​(Class<T> listenerClass,
                              Class<?> entityClass)
    • Method Detail

      • addEventMethod

        public void addEventMethod​(String event,
                                   Method method)
        INTERNAL: You can have multiple event methods for the same event, however, only one event method per class is permitted.
      • createEntityListenerAndInjectDependencies

        protected T createEntityListenerAndInjectDependencies​(Class<T> entityListenerClass)
        Create the wrapped listener and trigger CDI injection.
        Parameters:
        entityListenerClass - the EntityListener class
        Returns:
        the class instance that has had injection run on it. If injection fails, null.
      • constructListenerInstance

        protected T constructListenerInstance()
        Construct an instance of the wrapped entity listener This method will attempt to create the listener in a CDI injection friendly manner and if that fails, reflectively instantiate the class
        Returns:
        the entity listener instance
      • getEntityClass

        public Class<?> getEntityClass()
        INTERNAL:
      • setAllEventMethods

        public void setAllEventMethods​(Map<String,​List<Method>> methods)
        INTERNAL:
      • setOwningSession

        public void setOwningSession​(org.eclipse.persistence.internal.sessions.AbstractSession owningSession)
        INTERNAL:
      • getEventMethods

        protected List<Method> getEventMethods​(int eventCode)
        INTERNAL:
      • getEventMethods

        protected List<Method> getEventMethods​(String event)
        INTERNAL:
      • getLastEventMethod

        protected Method getLastEventMethod​(String event)
        INTERNAL: Assumes a check for event methods for the given event has been called beforehand.
      • getListener

        public T getListener()
      • getListenerClass

        public Class<?> getListenerClass()
        INTERNAL:
      • getOwningSession

        public org.eclipse.persistence.internal.sessions.AbstractSession getOwningSession()
        INTERNAL:
      • hasCallbackMethods

        public boolean hasCallbackMethods()
        INTERNAL:
      • hasEventMethods

        protected boolean hasEventMethods​(int eventCode)
        INTERNAL:
      • hasEventMethods

        protected boolean hasEventMethods​(String event)
        INTERNAL:
      • hasOverriddenEventMethod

        protected boolean hasOverriddenEventMethod​(List<Method> eventMethods,
                                                   Method eventMethod)
        INTERNAL:
      • hasOverriddenEventMethod

        protected boolean hasOverriddenEventMethod​(Method eventMethod,
                                                   int eventCode)
        INTERNAL:
      • hasOverriddenEventMethod

        protected boolean hasOverriddenEventMethod​(Method eventMethod,
                                                   String eventCode)
        INTERNAL:
      • isOverriddenEvent

        public boolean isOverriddenEvent​(org.eclipse.persistence.descriptors.DescriptorEvent event,
                                         List<org.eclipse.persistence.descriptors.DescriptorEventManager> eventManagers)
        INTERNAL: Return true if listener has a lifecycle callback method that is overridden in a subclass.
        Specified by:
        isOverriddenEvent in interface org.eclipse.persistence.descriptors.DescriptorEventListener
        Overrides:
        isOverriddenEvent in class org.eclipse.persistence.descriptors.DescriptorEventAdapter
      • postBuild

        public void postBuild​(org.eclipse.persistence.descriptors.DescriptorEvent event)
        INTERNAL:
        Specified by:
        postBuild in interface org.eclipse.persistence.descriptors.DescriptorEventListener
        Overrides:
        postBuild in class org.eclipse.persistence.descriptors.DescriptorEventAdapter
      • postClone

        public void postClone​(org.eclipse.persistence.descriptors.DescriptorEvent event)
        INTERNAL:
        Specified by:
        postClone in interface org.eclipse.persistence.descriptors.DescriptorEventListener
        Overrides:
        postClone in class org.eclipse.persistence.descriptors.DescriptorEventAdapter
      • postDelete

        public void postDelete​(org.eclipse.persistence.descriptors.DescriptorEvent event)
        INTERNAL:
        Specified by:
        postDelete in interface org.eclipse.persistence.descriptors.DescriptorEventListener
        Overrides:
        postDelete in class org.eclipse.persistence.descriptors.DescriptorEventAdapter
      • postInsert

        public void postInsert​(org.eclipse.persistence.descriptors.DescriptorEvent event)
        INTERNAL:
        Specified by:
        postInsert in interface org.eclipse.persistence.descriptors.DescriptorEventListener
        Overrides:
        postInsert in class org.eclipse.persistence.descriptors.DescriptorEventAdapter
      • postRefresh

        public void postRefresh​(org.eclipse.persistence.descriptors.DescriptorEvent event)
        INTERNAL:
        Specified by:
        postRefresh in interface org.eclipse.persistence.descriptors.DescriptorEventListener
        Overrides:
        postRefresh in class org.eclipse.persistence.descriptors.DescriptorEventAdapter
      • postUpdate

        public void postUpdate​(org.eclipse.persistence.descriptors.DescriptorEvent event)
        INTERNAL:
        Specified by:
        postUpdate in interface org.eclipse.persistence.descriptors.DescriptorEventListener
        Overrides:
        postUpdate in class org.eclipse.persistence.descriptors.DescriptorEventAdapter
      • prePersist

        public void prePersist​(org.eclipse.persistence.descriptors.DescriptorEvent event)
        INTERNAL:
        Specified by:
        prePersist in interface org.eclipse.persistence.descriptors.DescriptorEventListener
        Overrides:
        prePersist in class org.eclipse.persistence.descriptors.DescriptorEventAdapter
      • preRemove

        public void preRemove​(org.eclipse.persistence.descriptors.DescriptorEvent event)
        INTERNAL:
        Specified by:
        preRemove in interface org.eclipse.persistence.descriptors.DescriptorEventListener
        Overrides:
        preRemove in class org.eclipse.persistence.descriptors.DescriptorEventAdapter
      • preUpdateWithChanges

        public void preUpdateWithChanges​(org.eclipse.persistence.descriptors.DescriptorEvent event)
        INTERNAL:
        Specified by:
        preUpdateWithChanges in interface org.eclipse.persistence.descriptors.DescriptorEventListener
        Overrides:
        preUpdateWithChanges in class org.eclipse.persistence.descriptors.DescriptorEventAdapter
      • setPostBuildMethod

        public void setPostBuildMethod​(Method method)
        INTERNAL:
      • setPostCloneMethod

        public void setPostCloneMethod​(Method method)
        INTERNAL:
      • setPostDeleteMethod

        public void setPostDeleteMethod​(Method method)
        INTERNAL:
      • setPostInsertMethod

        public void setPostInsertMethod​(Method method)
        INTERNAL:
      • setPostRefreshMethod

        public void setPostRefreshMethod​(Method method)
        INTERNAL:
      • setPostUpdateMethod

        public void setPostUpdateMethod​(Method method)
        INTERNAL:
      • setPrePersistMethod

        public void setPrePersistMethod​(Method method)
        INTERNAL:
      • setPreRemoveMethod

        public void setPreRemoveMethod​(Method method)
        INTERNAL:
      • setPreUpdateWithChangesMethod

        public void setPreUpdateWithChangesMethod​(Method method)
        INTERNAL:
      • toString

        public String toString()
        INTERNAL: Used in the debugger.
        Overrides:
        toString in class Object
      • validateMethod

        protected void validateMethod​(Method method)
        INTERNAL:
      • validateMethodModifiers

        protected void validateMethodModifiers​(Method method)
        INTERNAL: