• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.annotations.Beta;
20 
21 import java.lang.annotation.ElementType;
22 import java.lang.annotation.Retention;
23 import java.lang.annotation.RetentionPolicy;
24 import java.lang.annotation.Target;
25 
26 /**
27  * Marks a method as an event subscriber.
28  *
29  * <p>The type of event will be indicated by the method's first (and only)
30  * parameter.  If this annotation is applied to methods with zero parameters,
31  * or more than one parameter, the object containing the method will not be able
32  * to register for event delivery from the {@link EventBus}.
33  *
34  * <p>Unless also annotated with @{@link AllowConcurrentEvents}, event subscriber
35  * methods will be invoked serially by each event bus that they are registered
36  * with.
37  *
38  * @author Cliff Biffle
39  * @since 10.0
40  */
41 @Retention(RetentionPolicy.RUNTIME)
42 @Target(ElementType.METHOD)
43 @Beta
44 public @interface Subscribe {
45 }
46