static Map<Class<?>, Set<EventHandler>> findAllSubscribers(Object listener) {
    Class<?> listenerClass = listener.getClass();
    Map<Class<?>, Set<EventHandler>> handlersInMethod = new HashMap<Class<?>, Set<EventHandler>>();

    Map<Class<?>, Set<Method>> methods = SUBSCRIBERS_CACHE.get(listenerClass);
    if (null == methods) {
      methods = new HashMap<Class<?>, Set<Method>>();
      loadAnnotatedSubscriberMethods(listenerClass, methods);
    }
    if (!methods.isEmpty()) {
      for (Map.Entry<Class<?>, Set<Method>> e : methods.entrySet()) {
        Set<EventHandler> handlers = new HashSet<EventHandler>();
        for (Method m : e.getValue()) {
          handlers.add(new EventHandler(listener, m));
        }
        handlersInMethod.put(e.getKey(), handlers);
      }
    }

    return handlersInMethod;
  }
static Map < Class < ? > , Set < EventHandler > > findAllSubscribers ( Object listener ) { Class < ? > listenerClass = listener . getClass ( ) ; Map < Class < ? > , Set < EventHandler > > handlersInMethod = new HashMap < Class < ? > , Set < EventHandler > > ( ) ; Map < Class < ? > , Set < Method > > methods = SUBSCRIBERS_CACHE . get ( listenerClass ) ; if ( null == methods ) { methods = new HashMap < Class < ? > , Set < Method > > ( ) ; loadAnnotatedSubscriberMethods ( listenerClass , methods ) ; } if ( ! methods . isEmpty ( ) ) { for ( Map . Entry < Class < ? > , Set < Method > > e : methods . entrySet ( ) ) { Set < EventHandler > handlers = new HashSet < EventHandler > ( ) ; for ( Method m : e . getValue ( ) ) { handlers . add ( new EventHandler ( listener , m ) ) ; } handlersInMethod . put ( e . getKey ( ) , handlers ) ; } } return handlersInMethod ; }
This implementation finds all methods marked with a {@link Subscribe} annotation.