Class TEventManager


  • public final class TEventManager
    extends AbstractLogger
    This class for managing events and these subscribers.
    Author:
    kong
    • Constructor Detail

      • TEventManager

        public TEventManager()
    • Method Detail

      • emit

        public java.lang.Object emit​(TEvent type,
                                     java.lang.Object... args)
        Emit an event with its parameters.
        Parameters:
        type - see TEvent
        args - a list parameters of this event
        Returns:
        the event result (the response of its subscribers), see Object or null
        See Also:
        TEventProducer.emit(TEvent, Object...)
      • subscribe

        public void subscribe()
        Collect all subscribers and these corresponding events.
      • hasSubscriber

        public boolean hasSubscriber​(TEvent type)
        Check if an event has any subscribers or not.
        Parameters:
        type - see TEvent
        Returns:
        true if an event has any subscribers
      • clear

        public void clear()
        Clear all subscribers and these corresponding events.