public class ContextConfigurationAttributes
extends java.lang.Object
ContextConfigurationAttributes encapsulates the context
configuration attributes declared on a test class via
@ContextConfiguration.ContextConfiguration,
SmartContextLoader.processContextConfiguration(ContextConfigurationAttributes),
MergedContextConfiguration| Constructor and Description |
|---|
ContextConfigurationAttributes(java.lang.Class<?> declaringClass,
ContextConfiguration contextConfiguration)
Construct a new
ContextConfigurationAttributes instance for the
supplied @ContextConfiguration annotation and
the test class that declared it. |
ContextConfigurationAttributes(java.lang.Class<?> declaringClass,
java.lang.String[] locations,
java.lang.Class<?>[] classes,
boolean inheritLocations,
java.lang.Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>[] initializers,
boolean inheritInitializers,
java.lang.Class<? extends ContextLoader> contextLoaderClass)
Construct a new
ContextConfigurationAttributes instance for the
test class that declared the
@ContextConfiguration annotation and its
corresponding attributes. |
ContextConfigurationAttributes(java.lang.Class<?> declaringClass,
java.lang.String[] locations,
java.lang.Class<?>[] classes,
boolean inheritLocations,
java.lang.Class<? extends ContextLoader> contextLoaderClass)
Deprecated.
as of Spring 3.2, use
ContextConfigurationAttributes(Class, String[], Class[], boolean, Class[], boolean, Class)
instead |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Class<?>[] |
getClasses()
Get the annotated classes that were declared via
@ContextConfiguration. |
java.lang.Class<? extends ContextLoader> |
getContextLoaderClass()
Get the
ContextLoader class that was declared via
@ContextConfiguration. |
java.lang.Class<?> |
getDeclaringClass()
Get the class that declared the
@ContextConfiguration annotation. |
java.lang.Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>[] |
getInitializers()
Get the
ApplicationContextInitializer classes that were declared via
@ContextConfiguration. |
java.lang.String[] |
getLocations()
Get the resource locations that were declared via
@ContextConfiguration. |
boolean |
hasClasses()
Determine if this
ContextConfigurationAttributes instance has
class-based resources. |
boolean |
hasLocations()
Determine if this
ContextConfigurationAttributes instance has
path-based resource locations. |
boolean |
hasResources()
Determine if this
ContextConfigurationAttributes instance has
either path-based resource locations or class-based resources. |
boolean |
isInheritInitializers()
Get the
inheritInitializers flag that was declared via
@ContextConfiguration. |
boolean |
isInheritLocations()
Get the
inheritLocations flag that was declared via
@ContextConfiguration. |
void |
setClasses(java.lang.Class<?>[] classes)
Set the processed annotated classes, effectively overriding the
original value declared via
@ContextConfiguration. |
void |
setLocations(java.lang.String[] locations)
Set the processed resource locations, effectively overriding the
original value declared via
@ContextConfiguration. |
java.lang.String |
toString()
Provide a String representation of the context configuration attributes
and declaring class.
|
public ContextConfigurationAttributes(java.lang.Class<?> declaringClass,
ContextConfiguration contextConfiguration)
ContextConfigurationAttributes instance for the
supplied @ContextConfiguration annotation and
the test class that declared it.declaringClass - the test class that declared @ContextConfigurationcontextConfiguration - the annotation from which to retrieve the attributes@Deprecated
public ContextConfigurationAttributes(java.lang.Class<?> declaringClass,
java.lang.String[] locations,
java.lang.Class<?>[] classes,
boolean inheritLocations,
java.lang.Class<? extends ContextLoader> contextLoaderClass)
ContextConfigurationAttributes(Class, String[], Class[], boolean, Class[], boolean, Class)
insteadContextConfigurationAttributes instance for the
test class that declared the
@ContextConfiguration annotation and its
corresponding attributes.declaringClass - the test class that declared @ContextConfigurationlocations - the resource locations declared via @ContextConfigurationclasses - the annotated classes declared via @ContextConfigurationinheritLocations - the inheritLocations flag declared via @ContextConfigurationcontextLoaderClass - the ContextLoader class declared via @ContextConfigurationjava.lang.IllegalArgumentException - if the declaringClass or contextLoaderClass is
null, or if the locations and classes are both non-emptypublic ContextConfigurationAttributes(java.lang.Class<?> declaringClass,
java.lang.String[] locations,
java.lang.Class<?>[] classes,
boolean inheritLocations,
java.lang.Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>[] initializers,
boolean inheritInitializers,
java.lang.Class<? extends ContextLoader> contextLoaderClass)
ContextConfigurationAttributes instance for the
test class that declared the
@ContextConfiguration annotation and its
corresponding attributes.declaringClass - the test class that declared @ContextConfigurationlocations - the resource locations declared via @ContextConfigurationclasses - the annotated classes declared via @ContextConfigurationinheritLocations - the inheritLocations flag declared via @ContextConfigurationinitializers - the context initializers declared via @ContextConfigurationinheritInitializers - the inheritInitializers flag declared via @ContextConfigurationcontextLoaderClass - the ContextLoader class declared via @ContextConfigurationjava.lang.IllegalArgumentException - if the declaringClass or contextLoaderClass is
null, or if the locations and classes are both non-emptypublic java.lang.Class<?> getDeclaringClass()
@ContextConfiguration annotation.nullpublic java.lang.String[] getLocations()
@ContextConfiguration.
Note: this is a mutable property. The returned value may therefore
represent a processed value that does not match the original value
declared via @ContextConfiguration.
null or emptyContextConfiguration.value(),
ContextConfiguration.locations(),
setLocations(String[])public void setLocations(java.lang.String[] locations)
@ContextConfiguration.getLocations()public java.lang.Class<?>[] getClasses()
@ContextConfiguration.
Note: this is a mutable property. The returned value may therefore
represent a processed value that does not match the original value
declared via @ContextConfiguration.
null or emptyContextConfiguration.classes(),
setClasses(Class[])public void setClasses(java.lang.Class<?>[] classes)
@ContextConfiguration.getClasses()public boolean hasLocations()
ContextConfigurationAttributes instance has
path-based resource locations.true if the locations array is not emptyhasResources(),
hasClasses()public boolean hasClasses()
ContextConfigurationAttributes instance has
class-based resources.true if the classes array is not emptyhasResources(),
hasLocations()public boolean hasResources()
ContextConfigurationAttributes instance has
either path-based resource locations or class-based resources.true if either the locations
or the classes array is not emptyhasLocations(),
hasClasses()public boolean isInheritLocations()
inheritLocations flag that was declared via
@ContextConfiguration.inheritLocations flagContextConfiguration.inheritLocations()public java.lang.Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>[] getInitializers()
ApplicationContextInitializer classes that were declared via
@ContextConfiguration.ApplicationContextInitializer classespublic boolean isInheritInitializers()
inheritInitializers flag that was declared via
@ContextConfiguration.inheritInitializers flagpublic java.lang.Class<? extends ContextLoader> getContextLoaderClass()
ContextLoader class that was declared via
@ContextConfiguration.ContextLoader classContextConfiguration.loader()public java.lang.String toString()
toString in class java.lang.Object