Class Event
- java.lang.Object
-
- java.util.EventObject
-
- org.apache.commons.configuration2.event.Event
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
ConfigurationBuilderEvent
,ConfigurationErrorEvent
,ConfigurationEvent
,ReloadingEvent
public class Event extends java.util.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 Description static EventType<Event>
ANY
The root event type for all configuration-related events.private static int
BUF_SIZE
Constant for the initial buffer size for the generation of the string representation.private EventType<? extends Event>
eventType
The type of this event.private static java.lang.String
FMT_PROPERTY
Constant for the format used in toString() for a property representation.private static long
serialVersionUID
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
appendPropertyRepresentation(java.lang.StringBuilder buf, java.lang.String property, java.lang.Object value)
Helper method for appending a representation for a property to the overall string representation for this object.EventType<? extends Event>
getEventType()
Gets the type of this event.java.lang.String
toString()
Returns a string representation for this object.
-
-
-
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).
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
FMT_PROPERTY
private static final java.lang.String FMT_PROPERTY
Constant for the format used in toString() for a property representation.- See Also:
- Constant Field Values
-
BUF_SIZE
private static final int BUF_SIZE
Constant for the initial buffer size for the generation of the string representation.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Event
public Event(java.lang.Object source, EventType<? extends Event> evType)
Creates a new instance ofEvent
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:
java.lang.IllegalArgumentException
- if a required parameter is null
-
-
Method Detail
-
appendPropertyRepresentation
protected void appendPropertyRepresentation(java.lang.StringBuilder buf, java.lang.String property, java.lang.Object value)
Helper method for appending a representation for a property to the overall string representation for this object. This method is called bytoString()
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 bufferproperty
- the name of the propertyvalue
- the property value
-
getEventType
public EventType<? extends Event> getEventType()
Gets the type of this event.- Returns:
- the event type
-
toString
public java.lang.String toString()
Returns a string representation for this object. This string contains the event class and a list of all properties.- Overrides:
toString
in classjava.util.EventObject
- Returns:
- a string for this object
-
-