T
- the event associated with this typepublic class EventType<T extends Event> extends Object implements Serializable
A class representing an event type.
The events produced by Commons Configuration all have a specific type. The event type can be used to determine the meaning of a specific event. It also acts as filter criterion when event listeners are registered. The listener is then called only for events of this type or derived types. The events in this library form a natural hierarchy with base types and more specialized types. By specifying an appropriate event type at listener registration time, it can be determined on a fine-granular basis which events are propagated to the listener.
Note: Users familiar with JavaFX probably recognize this approach to event handling. It allows for generic event listener interfaces and a natural selection of events to be processed.
Constructor and Description |
---|
EventType(EventType<? super T> superEventType,
String typeName)
Creates a new instance of
EventType and initializes it with the
super type and a type name. |
Modifier and Type | Method and Description |
---|---|
static Set<EventType<?>> |
fetchSuperEventTypes(EventType<?> eventType)
Returns a set with all event types that are super types of the specified
type.
|
String |
getName()
Returns the name of this event type.
|
EventType<? super T> |
getSuperType()
Returns the super event type.
|
static boolean |
isInstanceOf(EventType<?> derivedType,
EventType<?> baseType)
Checks whether an event type is derived from another type.
|
String |
toString()
Returns a string representation for this object.
|
public EventType(EventType<? super T> superEventType, String typeName)
EventType
and initializes it with the
super type and a type name. If no super type is specified, this is the
root event type.superEventType
- the super event typetypeName
- the name of this event typepublic EventType<? super T> getSuperType()
public String getName()
public String toString()
public static Set<EventType<?>> fetchSuperEventTypes(EventType<?> eventType)
eventType
- the event type in questionpublic static boolean isInstanceOf(EventType<?> derivedType, EventType<?> baseType)
baseType
is a direct or indirect
super type of derivedType
. If one of the types is null,
result is false.derivedType
- the derived event typebaseType
- the base event typeCopyright © 2001–2018 The Apache Software Foundation. All rights reserved.