Package civitas.celestis.event
Record Class HandlerReference
java.lang.Object
java.lang.Record
civitas.celestis.event.HandlerReference
- Record Components:
listener- The event listener instancemethod- The event handler method
A reference to an event handler. Contains contextual information required
to invoke the handler method, and retrieve its properties. While this is a
transient reference object, its methods consist of core operations which alter
the behavior of all event manager implementations. Exercise caution when
modifying a member of this class.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionHandlerReference(Listener listener, Method method) Creates an instance of aHandlerReferencerecord class. -
Method Summary
Modifier and TypeMethodDescription<E extends Handleable>
booleanaccepts(E event) Returns whether this handler accepts the provided event as its parameter.final booleanIndicates whether some other object is "equal to" this one.<E extends Handleable>
voidhandle(E event) Invokes the handler to process the event.final inthashCode()Returns a hash code value for this object.listener()Returns the value of thelistenerrecord component.method()Returns the value of themethodrecord component.priority()Returns the execution priority of this event handler.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
priority
Returns the execution priority of this event handler.- Returns:
- The execution priority of this event handler
- See Also:
-
accepts
Returns whether this handler accepts the provided event as its parameter.- Type Parameters:
E- The type of event to check for acceptance- Parameters:
event- The event of which to check for acceptance- Returns:
trueif this event handler accepts the event
-
handle
Invokes the handler to process the event.- Type Parameters:
E- The type of event to handle- Parameters:
event- The event of which to handle- Throws:
HandlerException- When an exception occurs during the processing of the event
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
listener
Returns the value of thelistenerrecord component.- Returns:
- the value of the
listenerrecord component
-
method
Returns the value of themethodrecord component.- Returns:
- the value of the
methodrecord component
-