Package jakarta.enterprise.inject.spi
Interface Interceptor<T>
- Type Parameters:
T
- the interceptor bean class
- All Superinterfaces:
Bean<T>
,BeanAttributes<T>
,Contextual<T>
Represents an enabled interceptor.
Since CDI 2.0, an implementation of this interface may implement Prioritized
in order to enable the interceptor with
given priority value for entire application.
-
Method Summary
Modifier and TypeMethodDescriptionObtains the interceptor bindings of the interceptor.intercept
(InterceptionType type, T instance, InvocationContext ctx) Invokes the specified kind of lifecycle callback or method invocation interception upon the given interceptor instance.boolean
intercepts
(InterceptionType type) Determines if the interceptor intercepts the specified kind of lifecycle callback or method invocation.Methods inherited from interface jakarta.enterprise.inject.spi.Bean
getBeanClass, getInjectionPoints
Methods inherited from interface jakarta.enterprise.inject.spi.BeanAttributes
getName, getQualifiers, getScope, getStereotypes, getTypes, isAlternative
Methods inherited from interface jakarta.enterprise.context.spi.Contextual
create, destroy
-
Method Details
-
getInterceptorBindings
Set<Annotation> getInterceptorBindings()Obtains the interceptor bindings of the interceptor.
- Returns:
- the set of interceptor bindings
-
intercepts
Determines if the interceptor intercepts the specified kind of lifecycle callback or method invocation.
- Parameters:
type
- the kind of interception- Returns:
- returns
true
if the interceptor intercepts callbacks or business methods of the given type, andfalse
otherwise.
-
intercept
Invokes the specified kind of lifecycle callback or method invocation interception upon the given interceptor instance.
- Parameters:
type
- the kind of interceptioninstance
- the interceptor instance to invokectx
- the context for the invocation- Returns:
- the invocation return value
- Throws:
Exception
- thrown by the target method and/or the following interceptors in the chain
-