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 InterceptorMethod
of
(MethodHandle receiverlessOrBoundMethodHandle) static InterceptorMethod
of
(MethodHandle mh, Supplier<?> receiverSupplier) Returns a newInterceptorMethod
that adapts the suppliedMethodHandle
and the suppliedSupplier
of its receiver.static InterceptorMethod
of
(MethodHandles.Lookup lookup, Method staticMethod) static InterceptorMethod
of
(MethodHandles.Lookup lookup, Method m, Supplier<?> targetSupplier) Returns a newInterceptorMethod
that adapts the suppliedMethod
and the suppliedSupplier
of 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 benull
staticMethod
- astatic
Method
; must not benull
; must accept exactly oneInvocationContext
-typed argument- Returns:
- a new
InterceptorMethod
; nevernull
- Throws:
NullPointerException
- iflookup
orstaticMethod
isnull
IllegalAccessException
- if unreflecting fails- See Also:
-
of
static InterceptorMethod of(MethodHandles.Lookup lookup, Method m, Supplier<?> targetSupplier) throws IllegalAccessException Returns a newInterceptorMethod
that adapts the suppliedMethod
and the suppliedSupplier
of its receiver.- Parameters:
lookup
- aMethodHandles.Lookup
; must not benull
m
- aMethod
; must not benull
; must accept exactly oneInvocationContext
-typed argumenttargetSupplier
- aSupplier
of the suppliedMethod
's receiver; often memoized; may benull
in which case the suppliedMethod
must bestatic
- Returns:
- a new
InterceptorMethod
; nevernull
- Throws:
NullPointerException
- iflookup
orm
isnull
IllegalAccessException
- 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
- ifreceiverlessOrBoundMethodHandle
isnull
- See Also:
-
of
Returns a newInterceptorMethod
that adapts the suppliedMethodHandle
and the suppliedSupplier
of 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 isInvocationContext
receiverSupplier
- aSupplier
of the suppliedMethodHandle
's receiver; often memoized; may benull
in which case the suppliedMethodHandle
must either not require a receiver or must be already bound to one- Returns:
- a new
InterceptorMethod
; nevernull
- Throws:
NullPointerException
- ifm
isnull
-