Annotation Type IoCContext
-
@Target({METHOD,CONSTRUCTOR,FIELD,PARAMETER}) @Retention(RUNTIME) @Documented @Repeatable(IoCContexts.class) public @interface IoCContext
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description Class<?>[]classesClasses that define the context we wish to work with.Class<? extends org.aopalliance.intercept.MethodInterceptor>implementedByimplementedBy()returns a Class that implementsMethodInterceptor.StringinstanceOnly meaningful when used as Parameter annotation.StringnameNames can be used to identify specific ObjectFactories for method injection on a test, if no name is specified, then a default name will be used, and parameters of the test will fail if the reference an annotation with a name that does not exits.Class<? extends ObjectFactory>objectFactoryClassClasses of object factory we wish to use, if none is specified a discovery of object factories will ensue, if only one is supported by the current classloader, it will be used.
-
-
-
Element Detail
-
name
String name
Names can be used to identify specific ObjectFactories for method injection on a test, if no name is specified, then a default name will be used, and parameters of the test will fail if the reference an annotation with a name that does not exits.- Returns:
- the name used to look up entities in this context
- Default:
- "__default"
-
-
-
instance
String instance
Only meaningful when used as Parameter annotation. Specifies the name of an instance in a the object factory related to this annotation we desire to be passed to the test as input at runtime.- Returns:
- the name of an instance in an
IoCContext
- Default:
- "__default"
-
-
-
classes
Class<?>[] classes
Classes that define the context we wish to work with.- Returns:
- an array of classes used to build an IoCContext (the means of doing so is up to the
objectFactoryClass())
- Default:
- {}
-
-
-
objectFactoryClass
Class<? extends ObjectFactory> objectFactoryClass
Classes of object factory we wish to use, if none is specified a discovery of object factories will ensue, if only one is supported by the current classloader, it will be used.- Returns:
- the implementation of
ObjectFactorywe wish to use to build the context
- Default:
- com.github.advisedtesting.core.ObjectFactory.class
-
-
-
implementedBy
Class<? extends org.aopalliance.intercept.MethodInterceptor> implementedBy
implementedBy()returns a Class that implementsMethodInterceptor. This field will be accessed via reflection so the name must be exact. If the class also implementsCloseabletheCloseable.close()method will be called at the close of the global context.- Returns:
- the
MethodInterceptorused to build the context, should never need to be changed.
- Default:
- com.github.advisedtesting.context.internal.IoCContextAdvice.class
-
-