@NonNull static Map<Class<?>,List<EventHandler>> findAllEventHandlersForSubscriber(@NonNull final Object subscriber){
  Map<Class<?>,List<EventHandler>> result=new HashMap<>();
  Class<?> currentSubscriberClass=subscriber.getClass();
  while (currentSubscriberClass != Object.class) {
    Map<Class<?>,EventHandlersCacheItem> cachedEventHandlers=mEventHandlersCache.get(currentSubscriberClass);
    if (cachedEventHandlers == null) {
synchronized (mEventHandlersCache) {
        cachedEventHandlers=mEventHandlersCache.get(currentSubscriberClass);
        if (cachedEventHandlers == null) {
          cachedEventHandlers=scanForEventHandlers(currentSubscriberClass);
          mEventHandlersCache.put(currentSubscriberClass,cachedEventHandlers);
        }
      }
    }
    for (    Map.Entry<Class<?>,EventHandlersCacheItem> entry : cachedEventHandlers.entrySet()) {
      List<EventHandler> eventHandlersByEventClass=result.get(entry.getKey());
      if (eventHandlersByEventClass == null) {
        eventHandlersByEventClass=new ArrayList<>(1);
        result.put(entry.getKey(),eventHandlersByEventClass);
      }
      for (EventHandlersCacheItem cacheItem=entry.getValue(); cacheItem != null; cacheItem=cacheItem.nextItem) {
        eventHandlersByEventClass.add(new EventHandler(subscriber,cacheItem.eventHandlerMethod,cacheItem.dispatchingMethod));
      }
    }
    currentSubscriberClass=currentSubscriberClass.getSuperclass();
  }
  return result;
}

@ NonNull static Map < Class < ? > , List < EventHandler > > findAllEventHandlersForSubscriber ( @ NonNull final Object subscriber ) { Map < Class < ? > , List < EventHandler > > result = new HashMap < > ( ) ; Class < ? > currentSubscriberClass = subscriber . getClass ( ) ; while ( currentSubscriberClass != Object . class ) { Map < Class < ? > , EventHandlersCacheItem > cachedEventHandlers = mEventHandlersCache . get ( currentSubscriberClass ) ; if ( cachedEventHandlers == null ) { synchronized ( mEventHandlersCache ) { cachedEventHandlers = mEventHandlersCache . get ( currentSubscriberClass ) ; if ( cachedEventHandlers == null ) { cachedEventHandlers = scanForEventHandlers ( currentSubscriberClass ) ; mEventHandlersCache . put ( currentSubscriberClass , cachedEventHandlers ) ; } } } for ( Map . Entry < Class < ? > , EventHandlersCacheItem > entry : cachedEventHandlers . entrySet ( ) ) { List < EventHandler > eventHandlersByEventClass = result . get ( entry . getKey ( ) ) ; if ( eventHandlersByEventClass == null ) { eventHandlersByEventClass = new ArrayList < > ( 1 ) ; result . put ( entry . getKey ( ) , eventHandlersByEventClass ) ; } for ( EventHandlersCacheItem cacheItem = entry . getValue ( ) ; cacheItem != null ; cacheItem = cacheItem . nextItem ) { eventHandlersByEventClass . add ( new EventHandler ( subscriber , cacheItem . eventHandlerMethod , cacheItem . dispatchingMethod ) ) ; } } currentSubscriberClass = currentSubscriberClass . getSuperclass ( ) ; } return result ; }
finds all methods on subscriber that can be used as event handlers , creating and eventhandler for every suitable method .
