org.axonframework.common.annotation
Class MultiParameterResolverFactory

java.lang.Object
  extended by org.axonframework.common.annotation.MultiParameterResolverFactory
All Implemented Interfaces:
ParameterResolverFactory

public class MultiParameterResolverFactory
extends Object
implements ParameterResolverFactory

ParameterResolverFactory instance that delegates to multiple other instances, in the order provided.

Since:
2.1
Author:
Allard Buijze

Constructor Summary
MultiParameterResolverFactory(List<ParameterResolverFactory> delegates)
          Initializes an instance that delegates to the given delegates, in the order provided.
MultiParameterResolverFactory(ParameterResolverFactory... delegates)
          Initializes an instance that delegates to the given delegates, in the order provided.
 
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.
 List<ParameterResolverFactory> getDelegates()
          Returns the delegates of this instance, in the order they are evaluated to resolve parameters.
static MultiParameterResolverFactory ordered(List<ParameterResolverFactory> delegates)
          Creates a MultiParameterResolverFactory instance with the given delegates, which are automatically ordered based on the @Priority annotation on their respective classes.
static MultiParameterResolverFactory ordered(ParameterResolverFactory... delegates)
          Creates a MultiParameterResolverFactory instance with the given delegates, which are automatically ordered based on the @Priority annotation on their respective classes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiParameterResolverFactory

public MultiParameterResolverFactory(ParameterResolverFactory... delegates)
Initializes an instance that delegates to the given delegates, in the order provided. Changes in the given array are not reflected in the created instance.

Parameters:
delegates - The factories providing the parameter values to use

MultiParameterResolverFactory

public MultiParameterResolverFactory(List<ParameterResolverFactory> delegates)
Initializes an instance that delegates to the given delegates, in the order provided. Changes in the given List are not reflected in the created instance.

Parameters:
delegates - The list of factories providing the parameter values to use
Method Detail

ordered

public static MultiParameterResolverFactory ordered(ParameterResolverFactory... delegates)
Creates a MultiParameterResolverFactory instance with the given delegates, which are automatically ordered based on the @Priority annotation on their respective classes. Classes with the same Priority are kept in the order as provided in the delegates.

If one of the delegates is a MultiParameterResolverFactory itself, that factory's delegates are 'mixed' with the given delegates, based on their respective order.

Parameters:
delegates - The delegates to include in the factory
Returns:
an instance delegating to the given delegates

ordered

public static MultiParameterResolverFactory ordered(List<ParameterResolverFactory> delegates)
Creates a MultiParameterResolverFactory instance with the given delegates, which are automatically ordered based on the @Priority annotation on their respective classes. Classes with the same Priority are kept in the order as provided in the delegates.

If one of the delegates is a MultiParameterResolverFactory itself, that factory's delegates are 'mixed' with the given delegates, based on their respective order.

Parameters:
delegates - The delegates to include in the factory
Returns:
an instance delegating to the given delegates

getDelegates

public List<ParameterResolverFactory> getDelegates()
Returns the delegates of this instance, in the order they are evaluated to resolve parameters.

Returns:
the delegates of this instance, in the order they are evaluated to resolve parameters

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.