java.lang.Object
java.lang.Record
flare.eventbus.EventSubscriber<T>
- Type Parameters:
T- - event type to subscribe to
- All Implemented Interfaces:
Comparable<EventSubscriber<T>>
public record EventSubscriber<T>(Class<T> eventType, EventHandler<T> handler, int priority)
extends Record
implements Comparable<EventSubscriber<T>>
A subscriber to an event.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEventSubscriber(Class<T> eventType, EventHandler<T> handler) EventSubscriber(Class<T> eventType, EventHandler<T> handler, int priority) Creates an instance of aEventSubscriberrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintfinal booleanIndicates whether some other object is "equal to" this one.Returns the value of theeventTyperecord component.handler()Returns the value of thehandlerrecord component.final inthashCode()Returns a hash code value for this object.intpriority()Returns the value of thepriorityrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
NORMAL_PRIORITY
public static final int NORMAL_PRIORITY- See Also:
-
-
Constructor Details
-
EventSubscriber
Creates an instance of aEventSubscriberrecord class.- Parameters:
eventType- the value for theeventTyperecord componenthandler- the value for thehandlerrecord componentpriority- the value for thepriorityrecord component
-
EventSubscriber
-
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<T>
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
eventType
Returns the value of theeventTyperecord component.- Returns:
- the value of the
eventTyperecord component
-
handler
Returns the value of thehandlerrecord component.- Returns:
- the value of the
handlerrecord component
-
priority
public int priority()Returns the value of thepriorityrecord component.- Returns:
- the value of the
priorityrecord component
-