Interface InterceptorMethod
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A representation of a Jakarta Interceptors interceptor method.
- Author:
- Laird Nelson
-
Method Summary
Modifier and TypeMethodDescriptionPerforms interception and returns any result.static InterceptorMethodof(MethodHandle receiverlessOrBoundMethodHandle) static InterceptorMethodof(MethodHandle mh, Supplier<?> receiverSupplier) Returns a newInterceptorMethodthat adapts the suppliedMethodHandleand the suppliedSupplierof its receiver.static InterceptorMethodof(MethodHandles.Lookup lookup, Method staticMethod) static InterceptorMethodof(MethodHandles.Lookup lookup, Method m, Supplier<?> targetSupplier) Returns a newInterceptorMethodthat adapts the suppliedMethodand the suppliedSupplierof its receiver.
-
Method Details
-
intercept
Performs interception and returns any result.- Parameters:
ic- anInvocationContext; must not benull- Returns:
- the result of interception, often computed by invoking the
InvocationContext.proceed()method; the return value may benull - Throws:
Exception- if any error occurs
-
of
static InterceptorMethod of(MethodHandles.Lookup lookup, Method staticMethod) throws IllegalAccessException - Parameters:
lookup- aMethodHandles.Lookup; must not benullstaticMethod- astaticMethod; must not benull; must accept exactly oneInvocationContext-typed argument- Returns:
- a new
InterceptorMethod; nevernull - Throws:
NullPointerException- iflookuporstaticMethodisnullIllegalAccessException- if unreflecting fails- See Also:
-
of
static InterceptorMethod of(MethodHandles.Lookup lookup, Method m, Supplier<?> targetSupplier) throws IllegalAccessException Returns a newInterceptorMethodthat adapts the suppliedMethodand the suppliedSupplierof its receiver.- Parameters:
lookup- aMethodHandles.Lookup; must not benullm- aMethod; must not benull; must accept exactly oneInvocationContext-typed argumenttargetSupplier- aSupplierof the suppliedMethod's receiver; often memoized; may benullin which case the suppliedMethodmust bestatic- Returns:
- a new
InterceptorMethod; nevernull - Throws:
NullPointerException- iflookupormisnullIllegalAccessException- if unreflecting fails- See Also:
-
of
- Parameters:
receiverlessOrBoundMethodHandle- aMethodHandle; must not benull; must either not require a receiver or must be already bound to one; must accept exactly oneInvocationContext-typed argument- Returns:
- a new
InterceptorMethod; nevernull - Throws:
NullPointerException- ifreceiverlessOrBoundMethodHandleisnull- See Also:
-
of
Returns a newInterceptorMethodthat adapts the suppliedMethodHandleand the suppliedSupplierof its receiver.- Parameters:
mh- aMethodHandle; must not benull; must either accept two arguments where the first argument's type is a valid receiver type and the second argument's type isInvocationContext, or one argument whose type isInvocationContextreceiverSupplier- aSupplierof the suppliedMethodHandle's receiver; often memoized; may benullin which case the suppliedMethodHandlemust either not require a receiver or must be already bound to one- Returns:
- a new
InterceptorMethod; nevernull - Throws:
NullPointerException- ifmisnull
-