jakarta.interceptor.InterceptorBinding Maven / Gradle / Ivy
/*
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package jakarta.interceptor;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
/**
* Specifies that an annotation type is an interceptor binding type.
*
*
* @Inherited
* @InterceptorBinding
* @Target({ TYPE, METHOD, CONSTRUCTOR })
* @Retention(RUNTIME)
* public @interface Valid {
* }
*
*
*
* Interceptor bindings are intermediate annotations that may be used to associate interceptors with target beans.
*
*
*
* The interceptor bindings of an interceptor are specified by annotating the interceptor class with the binding types
* and the {@link Interceptor Interceptor} annotation.
*
*
*
* @Valid @Interceptor
* public class ValidationInterceptor { ... }
*
*
*
* An interceptor may specify multiple interceptor bindings.
*
*
*
* An interceptor binding of a bean may be declared by annotating the bean class, a method of the bean class, or a
* constructor of the bean class with the interceptor binding type.
*
*
*
* @Valid
* public class Order { ... }
*
*
*
* @Valid @Secure
* public void updateOrder(Order order) { ... }
*
*
*
* @Valid
* public Order(...) { ... }
*
*
*
* A bean class or method of a bean class may declare multiple interceptor bindings.
*
*
*
* An interceptor binding type may declare other interceptor bindings.
*
*
*
* @Inherited
* @InterceptorBinding
* @Target({ TYPE, METHOD })
* @Retention(RUNTIME)
* @Valid
* public @interface Secure {
* }
*
*
*
* Interceptor bindings are transitive—an interceptor binding declared by an interceptor binding type is inherited
* by all beans and other interceptor binding types that declare that interceptor binding type.
*
*
* @see Interceptor
*
* @since Jakarta Interceptors 1.1
*/
@Target(ANNOTATION_TYPE)
@Retention(RUNTIME)
@Documented
public @interface InterceptorBinding {
}