Class EventBus

    • Constructor Detail

      • EventBus

        public EventBus()
        Instantiates EventBus with default exception handler
    • Method Detail

      • register

        public void register​(@Nonnull
                             Object object)
        Registers subscriber to EventBus. All methods in subscriber and it's parent classes are checked for Subscribe annotation and then added to map of subscriptions.
        Parameters:
        object - subscriber to register
        Throws:
        IllegalArgumentException - in case subscriber method name is wrong (correct format is 'on' + EventName
      • unregister

        public void unregister​(@Nonnull
                               Object object)
        Unregisters all subscribed methods from provided subscriber object.
        Parameters:
        object - object to unsubscribe from
      • post

        public void post​(@Nonnull
                         Object event)
        Posts provided event to all registered subscribers. Subscriber calls are invoked immediately, ordered by priority then their declaring class' name.
        Parameters:
        event - event to post