1 /*
2 * Copyright (C) 2012-2024 RRiBbit.org
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 * https://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 package org.rribbit;
17
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 import org.rribbit.creation.ListenerObjectCreator;
24 import org.rribbit.execution.ListenerObjectExecutor;
25
26 /**
27 * This annotation is used to declare a Listener in RRiBbit. Whenever you declare this annotation on a method, it will be eligible for invocation by RRiBbit's
28 * {@link ListenerObjectExecutor}, provided that the target method has been processed by an appropriate {@link ListenerObjectCreator}.
29 * <p />
30 * This annotation should only be declared on public methods, since non-public methods will be ignored by RRiBbit. Please note that in Java, method annotations are NOT inherited. This means
31 * that, if you override/implement a method in a subclass or subinterface, and the overriding/implementing method does not have the annotation, then that method will not inherit it. If a
32 * class or interface just inherits a method, without overriding it, then the annotation WILL exist.
33 * <p />
34 * The hint parameter can contain both a single hint or a list of hints.
35 * <p />
36 * NOTE: When using interface-based Spring Proxy's, you have to declare your {@link Listener} annotations on the interface-methods, not the class methods. RRiBbit does not even need to
37 * know about the implementing classes, it will simply ask Spring for a bean that implements the interface that the method is declared in.
38 *
39 * @author G.J. Schouten
40 *
41 */
42 @Retention(RetentionPolicy.RUNTIME)
43 @Target(ElementType.METHOD)
44 public @interface Listener {
45
46 String[] hint() default "";
47 }