Class AbstractAnnotatedParameterResolverFactory<A extends Annotation,P>

java.lang.Object
org.axonframework.messaging.core.annotation.AbstractAnnotatedParameterResolverFactory<A,P>
Type Parameters:
A - The type of annotation to check for
P - The type the parameter needs to be assignable from.
All Implemented Interfaces:
ParameterResolverFactory
Direct Known Subclasses:
AggregateTypeParameterResolverFactory, MessageIdentifierParameterResolverFactory, SequenceNumberParameterResolverFactory, SourceIdParameterResolverFactory, TimestampParameterResolverFactory

public abstract class AbstractAnnotatedParameterResolverFactory<A extends Annotation,P> extends Object implements ParameterResolverFactory
ParameterResolverFactory that will supply a parameter resolver when a matching parameter annotation is paired with a suitable type of parameter.

Handling is in place to ensure that primitive parameter types will be resolved correctly from their respective wrapper types.

Since:
2.1.0
Author:
Mark Ingram
  • Constructor Details

    • AbstractAnnotatedParameterResolverFactory

      protected AbstractAnnotatedParameterResolverFactory(Class<A> annotationType, Class<P> declaredParameterType)
      Initialize a ParameterResolverFactory instance that resolves parameters of type declaredParameterType annotated with the given annotationType.
      Parameters:
      annotationType - the type of annotation that a prospective parameter should declare
      declaredParameterType - the type that the parameter value should be assignable to
  • Method Details

    • getResolver

      protected abstract ParameterResolver<P> getResolver()
      Returns:
      the parameter resolver that is supplied when a matching parameter is located
    • createInstance

      @Nullable public ParameterResolver<P> createInstance(@Nonnull Executable executable, @Nonnull Parameter[] parameters, int parameterIndex)
      Description copied from interface: ParameterResolverFactory
      If available, creates a ParameterResolver instance that can provide a parameter of type parameterType for a given message.

      If the ParameterResolverFactory cannot provide a suitable ParameterResolver, returns null.

      Specified by:
      createInstance in interface ParameterResolverFactory
      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 a ParameterResolver for.
      Returns:
      A suitable ParameterResolver, or null if none is found.