public class ResultParameterResolverFactory extends Object implements ParameterResolverFactory
The @ResultHandler
Meta-Annotation needs to be placed on handlers that support interacting with
the result type in its parameters.
Constructor and Description |
---|
ResultParameterResolverFactory() |
Modifier and Type | Method and Description |
---|---|
static Object |
callWithResult(Object result,
Callable<?> action)
Calls the given
action (typically a handler invocation) such that the given result is available
for injection as parameter |
ParameterResolver<Object> |
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 <T> T |
ignoringResultParameters(Supplier<T> action)
Performs the given
action ignoring any parameters expecting a result type. |
public static Object callWithResult(Object result, Callable<?> action) throws Exception
action
(typically a handler invocation) such that the given result
is available
for injection as parameterresult
- The result to make available for parameter injectionaction
- The action to takeException
- any exception thrown while executing the action
public static <T> T ignoringResultParameters(Supplier<T> action)
action
ignoring any parameters expecting a result type. This is typically used to
detect whether a handler is suitable for invocation prior to the result value being available.T
- The type of result expected from the actionaction
- The action to performpublic ParameterResolver<Object> 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.