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<?>
PREPARE_SHUTDOWN
static String
PREPARE_SHUTDOWN_NAME
static EventTypes<?>
SERVER_READY
static String
SERVER_READY_NAME
static EventTypes<?>
SERVER_SHUTDOWN
static String
SERVER_SHUTDOWN_NAME
static EventTypes<?>
SERVER_STARTUP
static String
SERVER_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)
boolean
equals(Object o)
T
getHook(EventListener.Event<T> e)
Deprecated.Class<T>
getHookType()
int
hashCode()
void
onMatch(EventListener.Event<?> e, Consumer<T> processor)
Runs the given processorConsumer
with theEventListener.Event.hook()
if the event type matches this type.String
type()
-
-
-
Field Detail
-
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
-
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 processorConsumer
with 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
-
-