Class Event
- All Implemented Interfaces:
Handleable,Unique<UUID>
- Direct Known Subclasses:
ApplicationEvent,CancellableEvent,NotificationEvent
Handleable. This class serves as the
superclass for all events.Serialization Standards
This section summarizes the standards subclasses of this class should meet
in order to be properly serialized by Events.toString(Handleable).
If these standards are to be ignored, toString() must be overridden
to properly print a string representation of the specific event. The default
serialization standards will be used if not overridden.
All fields will be serialized, along with their values separated by an
equals sign. ("=") If the field is not public, the serializer will
attempt to find its getter method. The getter method should be in the format
of "get" followed by its field's name with its first letter capitalized.
Getter methods must also have no parameters.
For example, the getter method for a variable content would be getContent(),
which takes no parameters and returns the type of content.
protected final String content;
public String getContent() {
return content;
}
For booleans, the getter convention is "is" followed by the field's
name with its first letter capitalized. (e.g. cancelled will be isCancelled())
As long as these standards are met, the serializer will automatically serialize
the event, eliminating the need to implement toString() for every event.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final HandleableThe cause of this event.protected final UUIDThe unique identifier of this event. -
Constructor Summary
ConstructorsConstructorDescriptionEvent()Creates a new event with a random unique identifier and no cause.Event(Handleable cause) Creates a new event with a random unique identifier.Creates a new event with no cause.Event(UUID uniqueId, Handleable cause) Creates a new event. -
Method Summary
-
Field Details
-
uniqueId
The unique identifier of this event. -
cause
The cause of this event.
-
-
Constructor Details
-
Event
public Event()Creates a new event with a random unique identifier and no cause. -
Event
Creates a new event with no cause.- Parameters:
uniqueId- The unique identifier of this event
-
Event
Creates a new event with a random unique identifier.- Parameters:
cause- The cause of this event
-
Event
Creates a new event.- Parameters:
uniqueId- The unique identifier of this eventcause- The cause of this event
-
-
Method Details
-
getUniqueId
Returns the unique identifier of this event.- Specified by:
getUniqueIdin interfaceHandleable- Specified by:
getUniqueIdin interfaceUnique<UUID>- Returns:
- The unique identifier of this event
-
getCause
Returns the cause of this event. If no cause was specified, this will returnnull.- Specified by:
getCausein interfaceHandleable- Returns:
- The cause of this event if specified,
nullif not
-
toString
Serializes this event into a string for debugging purposes. This should be customized for events which add extra parameters.
-