Package com.norconex.commons.lang.event
Class Event
- java.lang.Object
-
- java.util.EventObject
-
- com.norconex.commons.lang.event.Event
-
- All Implemented Interfaces:
Serializable
public class Event extends EventObject
An immutable event.- Since:
- 2.0.0
- Author:
- Pascal Essiembre
- See Also:
IEventListener, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classEvent.Builder<B extends Event.Builder<B>>
-
Field Summary
-
Fields inherited from class java.util.EventObject
source
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedEvent(Event.Builder<?> b)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object other)ThrowablegetException()Gets the exception, if any.StringgetMessage()Gets a message describing the event or giving precision.StringgetName()Gets the event name.ObjectgetSource()Gets the object representing the source of this event.inthashCode()booleanis(Event event)booleanis(String... eventName)StringtoString()Returns the event message, if set, or the return value oftoString()on source.
-
-
-
Constructor Detail
-
Event
protected Event(Event.Builder<?> b)
-
-
Method Detail
-
getSource
public Object getSource()
Gets the object representing the source of this event.- Overrides:
getSourcein classEventObject- Returns:
- the subject
-
getName
public String getName()
Gets the event name.- Returns:
- the event name
-
getMessage
public String getMessage()
Gets a message describing the event or giving precision.- Returns:
- message the messsage
-
getException
public Throwable getException()
Gets the exception, if any.- Returns:
- the exception or
null
-
is
public boolean is(Event event)
-
is
public boolean is(String... eventName)
-
toString
public String toString()
Returns the event message, if set, or the return value oftoString()on source.- Overrides:
toStringin classEventObject
-
-