Interface InterceptorHandler
public interface InterceptorHandler
The hook used to implement an interceptor.
It can be associated to a
Intercepts
marker.
IMPORTANT: if you want a delegate instance you have to provide a constructor
taking an object as parameter. Alternatively you can use a BiFunction<Method, Object[], Object>
constructor parameter to be able to delegate the invocation. Else you must provide a default constructor.
NOTE: if your interceptor doesn't take an invoker as parameter
(java.util.function.BiFunction<Method, Object[], Object>)
then the interceptor chain can be broken if you invoke yourself a method. It is recommended to respect it.-
Method Summary
Modifier and TypeMethodDescriptiondefault <T extends Annotation>
Optional<T>findAnnotation
(Method method, Class<T> type) Called instead of the delegate method.
-
Method Details
-
invoke
Called instead of the delegate method.- Parameters:
method
- th emethod being invoked.args
- the parameters of the method.- Returns:
- the returned value of the method.
-
findAnnotation
-