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
- Version:
- $Id: Event.java 1790899 2017-04-10 21:56:46Z ggregory $
- See Also:
- Serialized Form
-
-
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()
Returns the type of this event.java.lang.String
toString()
Returns a string representation for this object.
-
-
-
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
-
getEventType
public EventType<? extends Event> getEventType()
Returns 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
-
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
-
-