Annotation Type Subscribe


  • @Retention(RUNTIME)
    @Target(METHOD)
    public @interface Subscribe
    Indicates a method is an event consumer. The method must have a single argument and the argument's type determines what type of events should be delivered to the method for consumption.

    For example:

     @Subscribe
     public void onSomeEvent(SomeEvent event) { ... }
     

    Because the method argument is declared as a SomeEvent type, the method will be called by the event dispatcher whenever a SomeEvent instance (or one of its subclass instances that is not already registered) is published.

    Since:
    1.3