private Multimap < Class < ? > , Subscriber > findAllSubscribers ( Object listener ) { Multimap < Class < ? > , Subscriber > methodsInListener = HashMultimap . create ( ) ; Class < ? > clazz = listener . getClass ( ) ; for ( Method method : getAnnotatedMethods ( clazz ) ) { Class < ? > [ ] parameterTypes = method . getParameterTypes ( ) ; Class < ? > eventType = parameterTypes [ 0 ] ; methodsInListener . put ( eventType , Subscriber . create ( bus , listener , method ) ) ; } return methodsInListener ; }
Returns all subscribers for the given listener grouped by the type of event they subscribe to .