11d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert/* 21d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * Copyright (C) 2007 The Guava Authors 31d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * 41d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * Licensed under the Apache License, Version 2.0 (the "License"); 51d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * you may not use this file except in compliance with the License. 61d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * You may obtain a copy of the License at 71d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * 81d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * http://www.apache.org/licenses/LICENSE-2.0 91d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * 101d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * Unless required by applicable law or agreed to in writing, software 111d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * distributed under the License is distributed on an "AS IS" BASIS, 121d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 131d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * See the License for the specific language governing permissions and 141d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * limitations under the License. 151d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert */ 161d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert 171d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringertpackage com.google.common.eventbus; 181d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert 191d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringertimport com.google.common.annotations.Beta; 201d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringertimport java.lang.annotation.ElementType; 211d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringertimport java.lang.annotation.Retention; 221d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringertimport java.lang.annotation.RetentionPolicy; 231d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringertimport java.lang.annotation.Target; 241d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert 251d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert/** 261d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * Marks a method as an event handler, as used by 271d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * {@link AnnotatedHandlerFinder} and {@link EventBus}. 281d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * 291d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * <p>The type of event will be indicated by the method's first (and only) 301d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * parameter. If this annotation is applied to methods with zero parameters, 311d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * or more than one parameter, the object containing the method will not be able 321d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * to register for event delivery from the {@link EventBus}. 331d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * 341d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * <p>Unless also annotated with @{@link AllowConcurrentEvents}, event handler 351d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * methods will be invoked serially by each event bus that they are registered 361d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * with. 371d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * 381d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * @author Cliff Biffle 391d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * @since 10.0 401d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert */ 411d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert@Retention(RetentionPolicy.RUNTIME) 421d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert@Target(ElementType.METHOD) 431d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert@Beta 441d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringertpublic @interface Subscribe { 451d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert} 46