T
- the annotation typepublic static class TestContextAnnotationUtils.AnnotationDescriptor<T extends Annotation> extends Object
Annotation
, including the class on which the annotation is declared
as well as the merged annotation instance.
If the annotation is used as a meta-annotation, the root declaring class is not directly annotated with the annotation but rather indirectly via a composed annotation.
Given the following example, if we are searching for the @Transactional
annotation on the TransactionalTests
class, then the
properties of the AnnotationDescriptor
would be as follows.
TransactionalTests
class objectTransactionalTests
class objectTransactional
annotation@Transactional @ContextConfiguration({"/test-datasource.xml", "/repository-config.xml"}) public class TransactionalTests { }
Given the following example, if we are searching for the @Transactional
annotation on the UserRepositoryTests
class, then the
properties of the AnnotationDescriptor
would be as follows.
UserRepositoryTests
class objectRepositoryTests
class objectTransactional
annotation@Transactional @ContextConfiguration({"/test-datasource.xml", "/repository-config.xml"}) @Retention(RetentionPolicy.RUNTIME) public @interface RepositoryTests { } @RepositoryTests public class UserRepositoryTests { }
Modifier and Type | Method and Description |
---|---|
Set<T> |
findAllLocalMergedAnnotations()
Find all annotations of the specified annotation type
that are present or meta-present on the root declaring class of this descriptor or on any interfaces that the
root declaring class implements.
|
T |
getAnnotation()
Get the merged annotation for this descriptor.
|
Class<?> |
getDeclaringClass() |
Class<?> |
getRootDeclaringClass() |
TestContextAnnotationUtils.AnnotationDescriptor<T> |
next()
Find the next
TestContextAnnotationUtils.AnnotationDescriptor for the specified annotation
type in the hierarchy above the root declaring class of this descriptor. |
String |
toString()
Provide a textual representation of this
AnnotationDescriptor . |
public Class<?> getRootDeclaringClass()
public Class<?> getDeclaringClass()
public T getAnnotation()
@Nullable public TestContextAnnotationUtils.AnnotationDescriptor<T> next()
TestContextAnnotationUtils.AnnotationDescriptor
for the specified annotation
type in the hierarchy above the root declaring class of this descriptor.
If a corresponding annotation is found in the superclass hierarchy of the root declaring class, that will be returned. Otherwise, an attempt will be made to find a corresponding annotation in the enclosing class hierarchy of the root declaring class if appropriate.
null
public Set<T> findAllLocalMergedAnnotations()
Annotations
found,
or an empty set if none were found