Package io.jmix.data.impl
Class EntityListenerManager
java.lang.Object
io.jmix.data.impl.EntityListenerManager
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
protected static class
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.springframework.beans.factory.BeanFactory
protected Map<EntityListenerManager.Key,
List> protected boolean
protected ReadWriteLock
protected ThreadLocal<List<EntityListenerManager.ListenerExecution>>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(Class<?> entityClass, Class<?> listenerClass) Register an entity listener by its class.void
addListener
(Class<?> entityClass, String listenerBeanName) Register an entity listener which is a ManagedBean.void
enable
(boolean enable) protected List<?>
findListener
(Class<?> entityClass, EntityListenerType type) void
fireListener
(Object entity, EntityListenerType type, String storeName) getDeclaredListeners
(Class<?> entityClass) protected List<?>
getListener
(Class<?> entityClass, EntityListenerType type) protected void
logExecution
(EntityListenerType type, Object entity) void
removeListener
(Class<?> entityClass, Class<?> listenerClass) Unregister an entity listener.void
removeListener
(Class<?> entityClass, String listenerBeanName) Unregister an entity listener.
-
Field Details
-
beanFactory
@Autowired protected org.springframework.beans.factory.BeanFactory beanFactory -
cache
-
dynamicListeners
-
lock
-
enabled
protected volatile boolean enabled -
threadLocalExecutions
-
-
Constructor Details
-
EntityListenerManager
public EntityListenerManager()
-
-
Method Details
-
addListener
Register an entity listener by its class. The listener instance will be instantiated as a plain object.- Parameters:
entityClass
- entitylistenerClass
- listener class
-
removeListener
Unregister an entity listener.- Parameters:
entityClass
- entitylistenerClass
- listener class
-
addListener
Register an entity listener which is a ManagedBean.- Parameters:
entityClass
- entitylistenerBeanName
- listener bean name
-
removeListener
Unregister an entity listener.- Parameters:
entityClass
- entitylistenerBeanName
- listener bean name
-
fireListener
-
enable
public void enable(boolean enable) -
logExecution
-
getListener
-
findListener
-
getDeclaredListeners
-