org.axonframework.test
Class FixtureResourceParameterResolverFactory

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

public final class FixtureResourceParameterResolverFactory
extends Object
implements org.axonframework.common.annotation.ParameterResolverFactory

ParameterResolverFactory implementation that is aware of test-specific use cases. It uses a ThreadLocal to keep track of injectable resources.

Although all access to this fixture should be done using the static accessor methods, creation of an instance is still possible to comply with the ServiceLoader specification.

Furthermore, this factory creates lazy parameter resolver, which mean that unsupported parameters are only detected when a specific handler is invoked. This ensures that only the resources that are actually used inside a test need to be configured.

Since:
2.1
Author:
Allard Buijze

Constructor Summary
FixtureResourceParameterResolverFactory()
           
 
Method Summary
static void clear()
          Clears the injectable resources registered to the current thread.
 org.axonframework.common.annotation.ParameterResolver createInstance(Annotation[] memberAnnotations, Class<?> parameterType, Annotation[] parameterAnnotations)
           
static void registerResource(Object injectableResource)
          Registers an additional resource for injection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixtureResourceParameterResolverFactory

public FixtureResourceParameterResolverFactory()
Method Detail

createInstance

public org.axonframework.common.annotation.ParameterResolver createInstance(Annotation[] memberAnnotations,
                                                                            Class<?> parameterType,
                                                                            Annotation[] parameterAnnotations)
Specified by:
createInstance in interface org.axonframework.common.annotation.ParameterResolverFactory

registerResource

public static void registerResource(Object injectableResource)
Registers an additional resource for injection

Parameters:
injectableResource - the resource to inject into handler methods

clear

public static void clear()
Clears the injectable resources registered to the current thread.



Copyright © 2010-2016. All Rights Reserved.