Class EntityListenerManager

java.lang.Object
io.jmix.data.impl.EntityListenerManager

@Component("data_EntityListenerManager") public class EntityListenerManager extends Object
This bean allows to register and fire entity listeners.

Usually entity listeners are registered declaratively with @Listeners annotation on entity class. Methods addListener(Class, Class) and addListener(Class, String) allow to add listeners dynamically, e.g. to an entity from a base project.

  • Field Details

  • Constructor Details

    • EntityListenerManager

      public EntityListenerManager()
  • Method Details

    • addListener

      public void addListener(Class<?> entityClass, Class<?> listenerClass)
      Register an entity listener by its class. The listener instance will be instantiated as a plain object.
      Parameters:
      entityClass - entity
      listenerClass - listener class
    • removeListener

      public void removeListener(Class<?> entityClass, Class<?> listenerClass)
      Unregister an entity listener.
      Parameters:
      entityClass - entity
      listenerClass - listener class
    • addListener

      public void addListener(Class<?> entityClass, String listenerBeanName)
      Register an entity listener which is a ManagedBean.
      Parameters:
      entityClass - entity
      listenerBeanName - listener bean name
    • removeListener

      public void removeListener(Class<?> entityClass, String listenerBeanName)
      Unregister an entity listener.
      Parameters:
      entityClass - entity
      listenerBeanName - listener bean name
    • fireListener

      public void fireListener(Object entity, EntityListenerType type, String storeName)
    • enable

      public void enable(boolean enable)
    • logExecution

      protected void logExecution(EntityListenerType type, Object entity)
    • getListener

      protected List<?> getListener(Class<?> entityClass, EntityListenerType type)
    • findListener

      protected List<?> findListener(Class<?> entityClass, EntityListenerType type)
    • getDeclaredListeners

      protected List<String> getDeclaredListeners(Class<?> entityClass)