public class InterceptorChainParameterResolverFactory extends Object implements ParameterResolverFactory, ParameterResolver<InterceptorChain>
InterceptorChain
. InterceptorChain
can be initialized using static method initialize(InterceptorChain)
.
This can function only if there is an active UnitOfWork
.Constructor and Description |
---|
InterceptorChainParameterResolverFactory() |
Modifier and Type | Method and Description |
---|---|
static <R> R |
callWithInterceptorChain(InterceptorChain interceptorChain,
Callable<R> action)
Invoke the given
action with the given interceptorChain being available
for parameter injection. |
ParameterResolver<InterceptorChain> |
createInstance(Executable executable,
Parameter[] parameters,
int parameterIndex)
If available, creates a ParameterResolver instance that can provide a parameter of type
parameterType for a given message. |
static InterceptorChain |
currentInterceptorChain()
Returns the current interceptor chain registered for injection as a parameter.
|
static void |
initialize(InterceptorChain interceptorChain)
Deprecated.
|
boolean |
matches(Message<?> message)
Indicates whether this resolver is capable of providing a value for the given
message . |
InterceptorChain |
resolveParameterValue(Message<?> message)
Resolves the parameter value to use for the given
message , or null if no suitable
parameter value can be resolved. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
supportedPayloadType
public InterceptorChainParameterResolverFactory()
@Deprecated public static void initialize(InterceptorChain interceptorChain)
callWithInterceptorChain(InterceptorChain, Callable)
interceptorChain
- the interceptor chainpublic static <R> R callWithInterceptorChain(InterceptorChain interceptorChain, Callable<R> action) throws Exception
action
with the given interceptorChain
being available
for parameter injection. Because this parameter is not bound to a message, it is important
to invoke handlers using this method.R
- The type of response expected from the invocationinterceptorChain
- The InterceptorChain to consider for injection as parameteraction
- The action to invokeaction
Exception
- any exception that occurs while invoking given action
public static InterceptorChain currentInterceptorChain()
callWithInterceptorChain(InterceptorChain, Callable)
. When invoked outside the
scope of that method, this will return null
.callWithInterceptorChain(InterceptorChain, Callable)
public InterceptorChain resolveParameterValue(Message<?> message)
ParameterResolver
message
, or null
if no suitable
parameter value can be resolved.resolveParameterValue
in interface ParameterResolver<InterceptorChain>
message
- The message to resolve the value frompublic boolean matches(Message<?> message)
ParameterResolver
message
.matches
in interface ParameterResolver<InterceptorChain>
message
- The message to evaluatetrue
if this resolver can provide a value for the message, otherwise false
public ParameterResolver<InterceptorChain> createInstance(Executable executable, Parameter[] parameters, int parameterIndex)
ParameterResolverFactory
parameterType
for a given message.
If the ParameterResolverFactory cannot provide a suitable ParameterResolver, returns null
.
createInstance
in interface ParameterResolverFactory
executable
- The executable (constructor or method) to inspectparameters
- The parameters on the executable to inspectparameterIndex
- The index of the parameter to return a ParameterResolver fornull
if none is foundCopyright © 2010–2020. All rights reserved.