Module jakarta.cdi

Interface InterceptorInfo

  • All Superinterfaces:
    BeanInfo

    public interface InterceptorInfo
    extends BeanInfo
    Interceptors are managed beans annotated @Interceptor. An interceptor declares a set of interceptor binding annotations, used to associate the interceptor with target beans. It also declares at most one interceptor method for each interception type. Interception types are:
    • @AroundInvoke: intercept business method invocations,
    • @AroundConstruct: intercept constructor invocations,
    • @PostConstruct: called after the container creates the target instance and completes dependency injection,
    • @PreDestroy: called before the container destroys the target instance.
    Finally, an interceptor also needs to declare a @Priority to become enabled.

    Note that this description applies to CDI Lite. There are more ways to declare an interceptor, but those are only present in CDI Full.

    Since:
    4.0
    • Method Detail

      • interceptorBindings

        java.util.Collection<AnnotationInfo> interceptorBindings()
        Returns the set of interceptor binding annotations declared on this interceptor.
        Returns:
        immutable set of interceptor binding annotations, never null
      • intercepts

        boolean intercepts​(InterceptionType interceptionType)
        Returns whether this interceptor declares an interceptor method for given interception type.
        Parameters:
        interceptionType - the type of interception
        Returns:
        whether this interceptor declares an interceptor method for given interception type
      • isInterceptor

        default boolean isInterceptor()
        Description copied from interface: BeanInfo
        Returns whether this bean is an interceptor.
        Specified by:
        isInterceptor in interface BeanInfo
        Returns:
        whether this bean is an interceptor