Class InjectEntityParameterResolverFactory
java.lang.Object
org.axonframework.modelling.annotation.InjectEntityParameterResolverFactory
- All Implemented Interfaces:
ParameterResolverFactory
public class InjectEntityParameterResolverFactory
extends Object
implements ParameterResolverFactory
ParameterResolverFactory implementation that provides ParameterResolvers for
parameters annotated with InjectEntity.
The parameter can either be a ManagedEntity or the entity itself. The order of resolving the identity id is
as specified on the InjectEntity annotation.
- Since:
- 5.0.0
- Author:
- Mitchell Herrijgers
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionInjectEntityParameterResolverFactory(Configuration configuration) Initialize the factory with the givenconfiguration. -
Method Summary
Modifier and TypeMethodDescriptioncreateInstance(Executable executable, Parameter[] parameters, int parameterIndex) If available, creates aParameterResolverinstance that can provide a parameter of typeparameterTypefor a given message.
-
Constructor Details
-
InjectEntityParameterResolverFactory
Initialize the factory with the givenconfiguration. Theconfigurationshould contain aStateManagerto load entities from.This constructor depends on the
Configurationinstead of theStateManagerto prevent circular dependencies during creation of message handlers. For example, if the repository uses an annotation-based event state applier, it would construct methods, which would then require theStateManagerto be created during the construction of the parameter resolvers. This would lead to a circular dependency.- Parameters:
configuration- TheConfigurationto use for loading entities.
-
-
Method Details
-
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.
-