public class LifecycleCallbackRegistry extends Object
LifecycleEvent
enum.Constructor and Description |
---|
LifecycleCallbackRegistry(EntityResolver resolver)
Creates an empty callback registry.
|
Modifier and Type | Method and Description |
---|---|
void |
addCallback(LifecycleEvent type,
Class<?> entityClass,
String methodName)
Registers a callback method to be invoked on an entity class instances
when a lifecycle event occurs.
|
void |
addDefaultListener(LifecycleEvent type,
Object listener,
String methodName)
Registers a callback method to be invoked on a provided non-entity object
when a lifecycle event occurs on any entity that does not suppress
default callbacks.
|
void |
addDefaultListener(LifecycleListener listener)
Registers a
LifecycleListener for all events on all entities. |
void |
addListener(Class<?> entityClass,
LifecycleListener listener)
Registers a
LifecycleListener for all events on all entities. |
void |
addListener(LifecycleEvent type,
Class<?> entityClass,
Object listener,
String methodName)
Registers callback method to be invoked on a provided non-entity object
when a lifecycle event occurs for a specific entity.
|
void |
addListener(Object listener)
Adds a listener, mapping its methods to events based on annotations.
|
void |
clear()
Removes all listeners for all event types.
|
void |
clear(int type)
Removes listeners for a single event type.
|
boolean |
isEmpty(LifecycleEvent type)
Returns true if there are no listeners for a specific event type.
|
void |
performCallbacks(LifecycleEvent type,
Collection<?> objects)
Invokes callbacks of a specific type for a collection of entity objects.
|
void |
performCallbacks(LifecycleEvent type,
Persistent object)
Invokes callbacks of a specific type for a given entity object.
|
public LifecycleCallbackRegistry(EntityResolver resolver)
public void clear()
public void clear(int type)
public boolean isEmpty(LifecycleEvent type)
public void addDefaultListener(LifecycleListener listener)
LifecycleListener
for all events on all entities.
Note that listeners are not required to implement
LifecycleListener
interface. Other methods in this class can be
used to register arbitrary listeners.public void addDefaultListener(LifecycleEvent type, Object listener, String methodName)
public void addListener(Class<?> entityClass, LifecycleListener listener)
LifecycleListener
for all events on all entities.
Note that listeners are not required to implement
LifecycleListener
interface. Other methods in this class can be
used to register arbitrary listeners.public void addListener(LifecycleEvent type, Class<?> entityClass, Object listener, String methodName)
public void addCallback(LifecycleEvent type, Class<?> entityClass, String methodName)
public void addListener(Object listener)
public void performCallbacks(LifecycleEvent type, Persistent object)
public void performCallbacks(LifecycleEvent type, Collection<?> objects)
Copyright © 2001–2019 Apache Cayenne. All rights reserved.