T
- the event class to which this type appliespublic final class EventType<T extends Event> extends Object implements Serializable
Event
.
Event types form a hierarchy with the ROOT
(equals to
Event.ANY
) as its root. This is useful in event filter / handler
registration where a single event filter / handler can be registered to a
super event type and will be receiving its sub type events as well.
Note that you cannot construct two different EventType objects with the same
name and parent.
Note about deserialization: All EventTypes that are going to be deserialized
(e.g. as part of Event
deserialization), need to exist at the time of
deserialization. Deserialization of EventType will not create new EventType
objects.
Modifier and Type | Field and Description |
---|---|
static EventType<Event> |
ROOT
The root event type.
|
Constructor and Description |
---|
EventType()
Deprecated.
Do not use this constructor, as only one such EventType can exist
|
EventType(EventType<? super T> superType)
Constructs a new
EventType with the specified super type and
the name set to null . |
EventType(EventType<? super T> superType,
String name)
Constructs a new
EventType with the specified super type and
name. |
EventType(String name)
Constructs a new
EventType with the specified name and the
EventType.ROOT as its super type. |
Modifier and Type | Method and Description |
---|---|
String |
getName()
Gets the name of this event type.
|
EventType<? super T> |
getSuperType()
Gets the super type of this event type.
|
String |
toString()
Returns a string representation of this
EventType object. |
@Deprecated public EventType()
EventType
with the EventType.ROOT
as its
super type and the name set to null
.public EventType(String name)
EventType
with the specified name and the
EventType.ROOT
as its super type.name
- the nameIllegalArgumentException
- if an EventType with the same name and
ROOT
/Event.ANY
as parentpublic EventType(EventType<? super T> superType)
EventType
with the specified super type and
the name set to null
.superType
- the event super typeIllegalArgumentException
- if an EventType with "null" name and
under this supertype existspublic EventType(EventType<? super T> superType, String name)
EventType
with the specified super type and
name.superType
- the event super typename
- the nameIllegalArgumentException
- if an EventType with the same name and
superType existsSubmit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.