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.
        object - subscriber to register
        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.
        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.
        event - event to post