Home | History | Annotate | Download | only in eventbus
      1 /*
      2  * Copyright (C) 2007 The Guava Authors
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  * http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.google.common.eventbus;
     18 
     19 import com.google.common.collect.Multimap;
     20 
     21 /**
     22  * A method for finding event subscriber methods in objects, for use by
     23  * {@link EventBus}.
     24  *
     25  * @author Cliff Biffle
     26  */
     27 interface SubscriberFindingStrategy {
     28 
     29   /**
     30    * Finds all suitable event subscriber methods in {@code source}, organizes them
     31    * by the type of event they handle, and wraps them in {@link EventSubscriber} instances.
     32    *
     33    * @param source  object whose subscribers are desired.
     34    * @return EventSubscriber objects for each subscriber method, organized by event
     35    *         type.
     36    *
     37    * @throws IllegalArgumentException if {@code source} is not appropriate for
     38    *         this strategy (in ways that this interface does not define).
     39    */
     40   Multimap<Class<?>, EventSubscriber> findAllSubscribers(Object source);
     41 
     42 }
     43