Class HierarchicalParameterResolverFactory
java.lang.Object
org.axonframework.messaging.core.annotation.HierarchicalParameterResolverFactory
- All Implemented Interfaces:
ParameterResolverFactory
public class HierarchicalParameterResolverFactory
extends Object
implements ParameterResolverFactory
ParameterResolverFactory that first tries to resolve a parameter using the child factory. If that fails, it
tries the parent factory. This is useful to encapsulate a set of parameter resolvers that are only relevant in a
specific context, such as a specific Module.- Since:
- 5.0.0
- Author:
- Mitchell Herrijgers
-
Method Summary
Modifier and TypeMethodDescriptioncreate(ParameterResolverFactory parent, ParameterResolverFactory child) Creates a new hierarchicalParameterResolverFactorythat delegates to the givenparentandchildfactories.createInstance(Executable executable, Parameter[] parameters, int parameterIndex) If available, creates aParameterResolverinstance that can provide a parameter of typeparameterTypefor a given message.
-
Method Details
-
create
public static HierarchicalParameterResolverFactory create(@Nonnull ParameterResolverFactory parent, @Nonnull ParameterResolverFactory child) Creates a new hierarchicalParameterResolverFactorythat delegates to the givenparentandchildfactories. Thechildfactory is tried first, and if it cannot resolve the parameter, theparentfactory is tried.- Parameters:
parent- The parentParameterResolverFactoryto delegate to if the child cannot resolve the parameter.child- The childParameterResolverFactoryto try first.- Returns:
- A new hierarchical
ParameterResolverFactorythat delegates to the given factories.
-
createInstance
@Nullable public ParameterResolver<?> createInstance(@Nonnull Executable executable, @Nonnull Parameter[] parameters, int parameterIndex) Description copied from interface:ParameterResolverFactoryIf available, creates aParameterResolverinstance that can provide a parameter of typeparameterTypefor a given message.If the
ParameterResolverFactorycannot provide a suitableParameterResolver, returnsnull.- Specified by:
createInstancein interfaceParameterResolverFactory- Parameters:
executable- The executable (constructor or method) to inspect.parameters- The parameters on the executable to inspect.parameterIndex- The index of the parameter to return aParameterResolverfor.- Returns:
- A suitable
ParameterResolver, ornullif none is found.
-