Package com.tenio.event.external
Class TEventHandler<T>
- java.lang.Object
-
- com.tenio.event.external.TEventHandler<T>
-
- Type Parameters:
T
- the template
public final class TEventHandler<T> extends java.lang.Object
This class for handling events and these subscribers.- Author:
- kong
-
-
Constructor Summary
Constructors Constructor Description TEventHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear all events and these handlers.java.lang.Object
emit(TEvent type, T... args)
Emit an event with its parameters.void
subscribe(TEvent type, IEvent<T> event)
Create a link between an event and its list of event handlers.
-
-
-
Method Detail
-
subscribe
public void subscribe(TEvent type, IEvent<T> event)
Create a link between an event and its list of event handlers.
-
emit
public java.lang.Object emit(TEvent type, T... args)
Emit an event with its parameters.- Parameters:
type
- seeTEvent
args
- a list parameters of this event- Returns:
- the event result (the response of its subscribers), see
Object
or null
-
clear
public void clear()
Clear all events and these handlers.
-
-