org.axonframework.eventhandling.annotation
Class AbstractAnnotatedParameterResolverFactory<A,P>

java.lang.Object
  extended by org.axonframework.eventhandling.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:
SequenceNumberParameterResolverFactory, TimestampParameterResolverFactory

public abstract class AbstractAnnotatedParameterResolverFactory<A,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
Author:
Mark Ingram

Constructor Summary
protected AbstractAnnotatedParameterResolverFactory(Class<A> annotationType, Class<P> declaredParameterType)
          Initialize a ParameterResolverFactory instance that resolves parameters of type declaredParameterType annotated with the given annotationType.
 
Method Summary
 ParameterResolver createInstance(Annotation[] memberAnnotations, Class<?> parameterType, Annotation[] parameterAnnotations)
          If available, creates a ParameterResolver instance that can provide a parameter of type parameterType for a given message.
protected abstract  ParameterResolver<P> getResolver()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

getResolver

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

createInstance

public ParameterResolver createInstance(Annotation[] memberAnnotations,
                                        Class<?> parameterType,
                                        Annotation[] parameterAnnotations)
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:
memberAnnotations - annotations placed on the member (e.g. method)
parameterType - the parameter type to find a resolver for
parameterAnnotations - annotations placed on the parameter
Returns:
a suitable ParameterResolver, or null if none is found


Copyright © 2010-2016. All Rights Reserved.