• 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"); you may not use this file except
5  * in compliance with the License. You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software distributed under the License
10  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11  * or implied. See the License for the specific language governing permissions and limitations under
12  * the License.
13  */
14 
15 package com.google.common.eventbus;
16 
17 import com.google.common.annotations.Beta;
18 import java.lang.annotation.ElementType;
19 import java.lang.annotation.Retention;
20 import java.lang.annotation.RetentionPolicy;
21 import java.lang.annotation.Target;
22 
23 /**
24  * Marks a method as an event subscriber.
25  *
26  * <p>The type of event will be indicated by the method's first (and only) parameter, which cannot
27  * be primitive. If this annotation is applied to methods with zero parameters, or more than one
28  * parameter, the object containing the method will not be able to register for event delivery from
29  * the {@link EventBus}.
30  *
31  * <p>Unless also annotated with @{@link AllowConcurrentEvents}, event subscriber methods will be
32  * invoked serially by each event bus that they are registered with.
33  *
34  * @author Cliff Biffle
35  * @since 10.0
36  */
37 @Retention(RetentionPolicy.RUNTIME)
38 @Target(ElementType.METHOD)
39 @Beta
40 public @interface Subscribe {}
41