Package eu.cloudnetservice.driver.event
Interface RegisteredEventListener
- All Superinterfaces:
Comparable<RegisteredEventListener>
- All Known Implementing Classes:
DefaultRegisteredEventListener
Represents a listener which is registered in an event manager and is ready to accept an event. Event execution is not
concurrent as per the event manager contract, therefore there is no need for locking before event execution.
- Since:
- 4.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionchannel()Get the channel this event is listening to.default intGet the class type of the event the underlying listener is listening to.Get the annotation used on the original listener method to identify it as a listener method.voidFires the event by invoking the underlying method with the given event.instance()Get the instance of the listener class used to register all listeners in it.order()Get the priority defined in the @EventListener annotation on the original listener method.
-
Method Details
-
fireEvent
Fires the event by invoking the underlying method with the given event. The event type is ensured to only be the same type the listener defined in the method. Event execution is not concurrent as per the event manager contract, therefore there is no need for locking before event execution.- Parameters:
event- the event to fire.- Throws:
NullPointerException- if the given event is null.EventListenerException- if the underlying listeners throws an exception while handling the event.
-
eventListener
Get the annotation used on the original listener method to identify it as a listener method.- Returns:
- the annotation used on the original listener method.
-
order
Get the priority defined in the @EventListener annotation on the original listener method.- Returns:
- the priority of the underlying event listener.
-
channel
Get the channel this event is listening to. Defaults to * meaning that the listener listens to all channels.- Returns:
- the channel this event is listening to.
-
instance
Get the instance of the listener class used to register all listeners in it.- Returns:
- the instance of the listener class.
-
eventClass
Get the class type of the event the underlying listener is listening to.- Returns:
- the class type of the event this listener listens to.
-
compareTo
- Specified by:
compareToin interfaceComparable<RegisteredEventListener>
-