Package com.tenio.event.internal
Class LEventManager
- java.lang.Object
-
- com.tenio.logger.AbstractLogger
-
- com.tenio.event.internal.LEventManager
-
public final class LEventManager extends AbstractLogger
This class for managing events and these subscribers.- Author:
- kong
-
-
Constructor Summary
Constructors Constructor Description LEventManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear all subscribers and these corresponding events.java.lang.Object
emit(LEvent type, java.lang.Object... args)
Emit an event with its parametersboolean
hasSubscriber(LEvent type)
Check if an event has any subscribers or not.void
on(LEvent type, ISubscriber sub)
Add a subscriber's handler.void
subscribe()
Collect all subscribers and these corresponding events.
-
-
-
Method Detail
-
emit
public java.lang.Object emit(LEvent type, java.lang.Object... args)
Emit an event with its parameters- Parameters:
type
- seeLEvent
args
- a list parameters of this event- Returns:
- the event result (the response of its subscribers), see
Object
or null - See Also:
LEventProducer.emit(LEvent, Object...)
-
on
public void on(LEvent type, ISubscriber sub)
Add a subscriber's handler.- Parameters:
type
- seeLEvent
sub
- seeISubscriber
-
subscribe
public void subscribe()
Collect all subscribers and these corresponding events.
-
hasSubscriber
public boolean hasSubscriber(LEvent type)
Check if an event has any subscribers or not.- Parameters:
type
- seeLEvent
- Returns:
- true if an event has any subscribers
-
clear
public void clear()
Clear all subscribers and these corresponding events.
-
-