Class ResultParameterResolverFactory
java.lang.Object
org.axonframework.messaging.annotation.ResultParameterResolverFactory
- All Implemented Interfaces:
ParameterResolverFactory
ParameterResolverFactory that provides support for Parameters where the result of Handler execution is expected to
be injected. This is only possible in interceptor handlers that need to act on the result of downstream interceptors
or the regular handler.
The @ResultHandler Meta-Annotation needs to be placed on handlers that support interacting with
the result type in its parameters.
- Since:
- 4.4
- Author:
- Allard Buijze
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectcallWithResult(Object result, Callable<?> action) Calls the givenaction(typically a handler invocation) such that the givenresultis available for injection as parametercreateInstance(Executable executable, Parameter[] parameters, int parameterIndex) If available, creates a ParameterResolver instance that can provide a parameter of typeparameterTypefor a given message.static <T> TignoringResultParameters(Supplier<T> action) Performs the givenactionignoring any parameters expecting a result type.
-
Constructor Details
-
ResultParameterResolverFactory
public ResultParameterResolverFactory()
-
-
Method Details
-
callWithResult
Calls the givenaction(typically a handler invocation) such that the givenresultis available for injection as parameter- Parameters:
result- The result to make available for parameter injectionaction- The action to take- Returns:
- the result of the action
- Throws:
Exception- any exception thrown while executing theaction
-
ignoringResultParameters
Performs the givenactionignoring 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.- Type Parameters:
T- The type of result expected from the action- Parameters:
action- The action to perform- Returns:
- the result returned by the given action
-
createInstance
public ParameterResolver<Object> createInstance(Executable executable, Parameter[] parameters, int parameterIndex) Description copied from interface:ParameterResolverFactoryIf available, creates a ParameterResolver instance that can provide a parameter of typeparameterTypefor a given message.If the ParameterResolverFactory cannot provide a suitable ParameterResolver, returns
null.- Specified by:
createInstancein interfaceParameterResolverFactory- Parameters:
executable- The executable (constructor or method) to inspectparameters- The parameters on the executable to inspectparameterIndex- The index of the parameter to return a ParameterResolver for- Returns:
- a suitable ParameterResolver, or
nullif none is found
-