org.apache.commons.configuration2.event

## Class Event

- java.lang.Object
- - java.util.EventObject
  - - org.apache.commons.configuration2.event.Event

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    ConfigurationBuilderEvent, ConfigurationErrorEvent, ConfigurationEvent, ReloadingEvent

      public class Event
      extends EventObject

  The base class for all events generated by this library.

  The events produced by objects in this library are arranged in an inheritance hierarchy. This base class defines some basic properties common to all configuration events. Especially, an event has an `EventType` which describes its semantics. The event type can also be used for filtering for events or for defining event listeners on a fine-grained basis.

  Since:
    2.0
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static EventType<Event>` | `ANY` The root event type for all configuration-related events.

    - ### Fields inherited from class java.util.EventObject

      `source`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Event(Object source, EventType<? extends Event> evType)` Creates a new instance of `Event` and sets basic properties.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `appendPropertyRepresentation(StringBuilder buf, String property, Object value)` Helper method for appending a representation for a property to the overall string representation for this object.
    `EventType<? extends Event>` | `getEventType()` Returns the type of this event.
    `String` | `toString()` Returns a string representation for this object.

    - ### Methods inherited from class java.util.EventObject

      `getSource`

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

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

- - ### Field Detail

    - #### ANY

          public static final EventType<Event> ANY

      The root event type for all configuration-related events. All specific event types have this type as super direct (directly or indirectly).

  - ### Constructor Detail

    - #### Event

          public Event(Object source,
                       EventType<? extends Event> evType)

      Creates a new instance of `Event` and sets basic properties.
      Parameters:
        `source` - the object on which the Event initially occurred (must not be null)
        `evType` - the type of this event (must not be null)
      Throws:
        `IllegalArgumentException` - if a required parameter is null

  - ### Method Detail

    - #### getEventType

          public EventType<? extends Event> getEventType()

      Returns the type of this event.
      Returns:
        the event type

    - #### toString

          public String toString()

      Returns a string representation for this object. This string contains the event class and a list of all properties.
      Overrides:
        `toString` in class `EventObject`
      Returns:
        a string for this object

    - #### appendPropertyRepresentation

          protected void appendPropertyRepresentation(StringBuilder buf,
                                                      String property,
                                                      Object value)

      Helper method for appending a representation for a property to the overall string representation for this object. This method is called by `toString()` for generating string fragments for the properties of this class. It can also be used by derived classes which extend the string representation of this base class.
      Parameters:
        `buf` - the target buffer
        `property` - the name of the property
        `value` - the property value

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