org.axonframework.common.annotation
Class SimpleResourceParameterResolverFactory

java.lang.Object
  extended by org.axonframework.common.annotation.ParameterResolverFactory
      extended by org.axonframework.common.annotation.SimpleResourceParameterResolverFactory

public final class SimpleResourceParameterResolverFactory
extends ParameterResolverFactory

Implementation of the ParameterResolverFactory that injects a static list of resources into annotated handler parameters. Any resource is eligible for injection when its type matches the parameter of the annotated handler method.

Since this factory is configured at runtime, it must be registered before any annotated handlers are registered. Handlers that have been registered before will not have their parameter eligible for injection by this factory.

Since:
2.0
Author:
Allard Buijze

Method Summary
protected  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.
static void register(Collection<?> injectableResources)
          Registers the given injectableResources for the ParameterResolverFactory.
 boolean supportsPayloadResolution()
          Indicates whether this resolver may be used to resolve the payload parameter of an annotated handler method.
 
Methods inherited from class org.axonframework.common.annotation.ParameterResolverFactory
createPayloadResolver, findParameterResolver, registerFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

register

public static void register(Collection<?> injectableResources)
Registers the given injectableResources for the ParameterResolverFactory. This method must be called before any annotated handlers are registered. Handlers that have been registered before will not have their parameter eligible for injection by this factory.

Parameters:
injectableResources - The resources eligible for injection. Each resource is evaluated in the order provided by the iterator of the given collection.

supportsPayloadResolution

public boolean supportsPayloadResolution()
Description copied from class: ParameterResolverFactory
Indicates whether this resolver may be used to resolve the payload parameter of an annotated handler method.

Specified by:
supportsPayloadResolution in class ParameterResolverFactory
Returns:
whether this factory provides Parameter Resolvers that support payload parameters

createInstance

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


Copyright © 2010-2012. All Rights Reserved.