org.apache.commons.configuration2.event

## Class EventType<T extends Event>

- java.lang.Object
- - org.apache.commons.configuration2.event.EventType<T>

- Type Parameters:
    `T` - the event associated with this type

      public class EventType<T extends Event>
      extends Object

  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.

  Since:
    2.0
  Version:
    $Id: EventType.java 1624601 2014-09-12 18:04:36Z oheger $

- - ### Constructor Summary

    Constructors
    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.

  - ### Method Summary

    Methods
    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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### EventType

          public EventType(EventType<? super T> superEventType,
                   String typeName)

      Creates a new instance of `EventType` and initializes it with the super type and a type name. If no super type is specified, this is the root event type.
      Parameters:
        `superEventType` - the super event type
        `typeName` - the name of this event type

  - ### Method Detail

    - #### getSuperType

          public EventType<? super T> getSuperType()

      Returns the super event type. Result is null for the root event type.
      Returns:
        the super event type

    - #### getName

          public String getName()

      Returns the name of this event type. The name has no specific semantic meaning. It is just used for debugging purposes and also part of the string representation of this event type.
      Returns:
        the event type name

    - #### toString

          public String toString()

      Returns a string representation for this object. This method is mainly overridden for debugging purposes. The returned string contains the name of this event type.
      Overrides:
        `toString` in class `Object`
      Returns:
        a string for this object

    - #### fetchSuperEventTypes

          public static Set<EventType<?>> fetchSuperEventTypes(EventType<?> eventType)

      Returns a set with all event types that are super types of the specified type. This set contains the direct and indirect super types and also includes the given type itself. The passed in type may be null, then an empty set is returned.
      Parameters:
        `eventType` - the event type in question
      Returns:
        a set with all super event types

    - #### isInstanceOf

          public static boolean isInstanceOf(EventType<?> derivedType,
                             EventType<?> baseType)

      Checks whether an event type is derived from another type. This implementation tests whether `baseType` is a direct or indirect super type of `derivedType`. If one of the types is null, result is false.
      Parameters:
        `derivedType` - the derived event type
        `baseType` - the base event type
      Returns:
        true if the derived type is an instance of the base type, false otherwise

Copyright © 2001–2014 The Apache Software Foundation. All rights reserved.