Package jakarta.enterprise.inject.spi
Interface Interceptor<T>
-
- Type Parameters:
T
- the interceptor bean class
- All Superinterfaces:
Bean<T>
,BeanAttributes<T>
,Contextual<T>
public interface Interceptor<T> extends Bean<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.- Author:
- Gavin King, Pete Muir, David Allen
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Set<Annotation>
getInterceptorBindings()
Obtains the interceptor bindings of the interceptor.Object
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 Detail
-
getInterceptorBindings
Set<Annotation> getInterceptorBindings()
Obtains the interceptor bindings of the interceptor.
- Returns:
- the set of interceptor bindings
-
intercepts
boolean intercepts(InterceptionType type)
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
Object intercept(InterceptionType type, T instance, InvocationContext ctx) throws Exception
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
-
-