Class DefaultInterceptionService
java.lang.Object
org.glassfish.hk2.extras.interception.internal.DefaultInterceptionService
- All Implemented Interfaces:
InterceptionService
@Singleton
@Visibility(LOCAL)
public class DefaultInterceptionService
extends Object
implements InterceptionService
A default implementation of the interception service using annotation to
denote services that are to be intercepted and other annotations to match
methods or constructors to interceptors
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final IndexedFilter
private ServiceLocator
private static final IndexedFilter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList
<org.aopalliance.intercept.ConstructorInterceptor> getConstructorInterceptors
(Constructor<?> constructor) The single chosen constructor of a service that passes theInterceptionService.getDescriptorFilter()
method will be passed to this method to determine if it will interceptedIf the returned filter returns true then the methods of the service will be passed toInterceptionService.getMethodInterceptors(Method)
to determine if a method should be intercepted and the constructor of the service will be passed toInterceptionService.getConstructorInterceptors(Constructor)
to determine if the constructor should be interceptedList
<org.aopalliance.intercept.MethodInterceptor> getMethodInterceptors
(Method method) Each non-final method of a service that passes theInterceptionService.getDescriptorFilter()
method will be passed to this method to determine if it will interceptedprivate List
<ServiceHandle<org.aopalliance.intercept.ConstructorInterceptor>> orderConstructors
(Constructor<?> constructor, List<ServiceHandle<org.aopalliance.intercept.ConstructorInterceptor>> current) private List
<ServiceHandle<org.aopalliance.intercept.MethodInterceptor>> orderMethods
(Method method, List<ServiceHandle<org.aopalliance.intercept.MethodInterceptor>> current)
-
Field Details
-
METHOD_FILTER
-
CONSTRUCTOR_FILTER
-
locator
-
orderers
-
-
Constructor Details
-
DefaultInterceptionService
public DefaultInterceptionService()
-
-
Method Details
-
getDescriptorFilter
Description copied from interface:InterceptionService
If the returned filter returns true then the methods of the service will be passed toInterceptionService.getMethodInterceptors(Method)
to determine if a method should be intercepted and the constructor of the service will be passed toInterceptionService.getConstructorInterceptors(Constructor)
to determine if the constructor should be intercepted- Specified by:
getDescriptorFilter
in interfaceInterceptionService
- Returns:
- The filter that will be applied to a descriptor to determine if it is to be intercepted. Should not return null
-
orderMethods
private List<ServiceHandle<org.aopalliance.intercept.MethodInterceptor>> orderMethods(Method method, List<ServiceHandle<org.aopalliance.intercept.MethodInterceptor>> current) -
orderConstructors
private List<ServiceHandle<org.aopalliance.intercept.ConstructorInterceptor>> orderConstructors(Constructor<?> constructor, List<ServiceHandle<org.aopalliance.intercept.ConstructorInterceptor>> current) -
getMethodInterceptors
Description copied from interface:InterceptionService
Each non-final method of a service that passes theInterceptionService.getDescriptorFilter()
method will be passed to this method to determine if it will intercepted- Specified by:
getMethodInterceptors
in interfaceInterceptionService
- Parameters:
method
- A non-final method that may be intercepted- Returns:
- if null (or an empty list) then this method should NOT be intercepted. Otherwise the list of interceptors to apply to this method
-
getConstructorInterceptors
public List<org.aopalliance.intercept.ConstructorInterceptor> getConstructorInterceptors(Constructor<?> constructor) Description copied from interface:InterceptionService
The single chosen constructor of a service that passes theInterceptionService.getDescriptorFilter()
method will be passed to this method to determine if it will intercepted- Specified by:
getConstructorInterceptors
in interfaceInterceptionService
- Parameters:
constructor
- A constructor that may be intercepted- Returns:
- if null (or an empty list) then this constructor should NOT be intercepted. Otherwise the list of interceptors to apply to this method
-