Package org.glassfish.api.event
Class EventTypes<T>
- java.lang.Object
-
- org.glassfish.api.event.EventTypes<T>
-
public final class EventTypes<T> extends Object
Extensible list of event types. EventTypes are created through the create method and not directly. Events can be compared using == or equals although == is recommended.- Author:
- dochez
-
-
Field Summary
Fields Modifier and Type Field Description static EventTypes<?>POST_SERVER_INITstatic StringPOST_SERVER_INIT_NAMEstatic EventTypes<?>PREPARE_SHUTDOWNstatic StringPREPARE_SHUTDOWN_NAMEstatic EventTypes<?>SERVER_READYstatic StringSERVER_READY_NAMEstatic EventTypes<?>SERVER_SHUTDOWNstatic StringSERVER_SHUTDOWN_NAMEstatic EventTypes<?>SERVER_STARTUPstatic StringSERVER_STARTUP_NAME
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static EventTypes<?>create(String name)static <T> EventTypes<T>create(String name, Class<T> hookType)booleanequals(Object o)TgetHook(EventListener.Event<T> e)Deprecated.Class<T>getHookType()inthashCode()voidonMatch(EventListener.Event<?> e, Consumer<T> processor)Runs the given processorConsumerwith theEventListener.Event.hook()if the event type matches this type.Stringtype()
-
-
-
Field Detail
-
POST_SERVER_INIT_NAME
public static final String POST_SERVER_INIT_NAME
- See Also:
- Constant Field Values
-
SERVER_STARTUP_NAME
public static final String SERVER_STARTUP_NAME
- See Also:
- Constant Field Values
-
SERVER_READY_NAME
public static final String SERVER_READY_NAME
- See Also:
- Constant Field Values
-
PREPARE_SHUTDOWN_NAME
public static final String PREPARE_SHUTDOWN_NAME
- See Also:
- Constant Field Values
-
SERVER_SHUTDOWN_NAME
public static final String SERVER_SHUTDOWN_NAME
- See Also:
- Constant Field Values
-
POST_SERVER_INIT
public static final EventTypes<?> POST_SERVER_INIT
-
SERVER_STARTUP
public static final EventTypes<?> SERVER_STARTUP
-
SERVER_READY
public static final EventTypes<?> SERVER_READY
-
SERVER_SHUTDOWN
public static final EventTypes<?> SERVER_SHUTDOWN
-
PREPARE_SHUTDOWN
public static final EventTypes<?> PREPARE_SHUTDOWN
-
-
Method Detail
-
create
public static EventTypes<?> create(String name)
-
create
public static <T> EventTypes<T> create(String name, Class<T> hookType)
-
type
public String type()
-
getHook
@Deprecated public T getHook(EventListener.Event<T> e)
Deprecated.- Parameters:
e- not null- Returns:
- the events hook or null in case the given event is not matching this type
-
onMatch
public void onMatch(EventListener.Event<?> e, Consumer<T> processor)
Runs the given processorConsumerwith theEventListener.Event.hook()if the event type matches this type.- Parameters:
e- the event to process by the processor, not nullprocessor- the code to run with the event hook, not null
-
-