|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface LifecycleEvent<T>
The base interface for IOC Lifecycle events. Components may fire IOC Lifecycle events to broadcast events to interested listeners that do not perfectly map to one of the supported IOC scopes. The general usage for firing an event is:
Accessevent = IOC.getBeanManager().lookup(Creation.class).getInstance(); // Need to set an instance for the event. event.setInstance("String Instance!"); event.fireAsync(new LifecycleCallback() { @Override
public void callback(boolean success) { if (success) { // Go through with the action } } });
LifecycleListeners
can access the event
instance or veto the event.
Method Summary | |
---|---|
void |
fireAsync(T instance)
Fire this event, notifying any listeners for this event type by calling the respective LifecycleListener.observeEvent(LifecycleEvent) methods. |
void |
fireAsync(T instance,
LifecycleCallback callback)
Fire this event, notifying any listeners for this event type by calling the respective LifecycleListener.observeEvent(LifecycleEvent) methods. |
T |
getInstance()
This method should only be called from within LifecycleListener.observeEvent(LifecycleEvent) . |
void |
veto()
Veto this event. |
Method Detail |
---|
void fireAsync(T instance)
LifecycleListener.observeEvent(LifecycleEvent)
methods.
instance
- The bean instance associated with this event.void fireAsync(T instance, LifecycleCallback callback)
LifecycleListener.observeEvent(LifecycleEvent)
methods.
instance
- The bean instance associated with this event.callback
- A callback for receiving the result of a fired event (whether or not any listeners
vetoed.void veto()
LifecycleListener
during the
LifecycleListener.observeEvent(LifecycleEvent)
then:
LifecycleCallback.callback(boolean)
will be invoked with the
parameter value false
.
T getInstance()
LifecycleListener.observeEvent(LifecycleEvent)
. The instance is set immediately before
calling listeners and unset immediately after.
null
if this event is not
actively being fired.
|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |