-
- 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 java.util.Set<java.lang.annotation.Annotation>
getInterceptorBindings()
Obtains the interceptor bindings of the interceptor.java.lang.Object
intercept(InterceptionType type, T instance, jakarta.interceptor.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
java.util.Set<java.lang.annotation.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
java.lang.Object intercept(InterceptionType type, T instance, jakarta.interceptor.InvocationContext ctx) throws java.lang.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:
java.lang.Exception
- thrown by the target method and/or the following interceptors in the chain
-
-