Eventbus subscribers, by design, are statically tied to a particular type of object i.e. the class of the event it is interested in. This in most cases is beneficial and easy to use, however, in some cases (typically event agnostic, middlemen, which stores the event for later investigation), the event processing is much the same irrespective of the type of event it receives. In such a case, it will be an overhead (even if possible) to define a subscriber for each kind of event existing in the system. This special subscriber is a way to achieve dynamic interests (immutable after registration) in subscribers. Although, this subscriber can only listen to one type of event but the type is defined at runtime as opposed to compile time in a normal subscriber. Although, this subscriber does not mandate that the subscriber must have a subscribe method (one annotated with {@link Subscribe}) listening to event type {@link Object} but in most of the cases, such a subscribe method willprove to be more useful. {@link EventBus} allows specifying the subscribe method with argument {@link Object}only for these subscribers. Implementations must only have a single subscriber method or else the registration with eventbus will be rejected. This limitation is imposed as we do not want to make runtime decisions on which subscribe method an event must be directed to.
@author Nitesh Kant
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.