Class TestContextAnnotationUtils.AnnotationDescriptor<T extends Annotation>
- Type Parameters:
T- the annotation type
- Direct Known Subclasses:
TestContextAnnotationUtils.UntypedAnnotationDescriptor
- Enclosing class:
TestContextAnnotationUtils
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.
- rootDeclaringClass:
TransactionalTestsclass object - declaringClass:
TransactionalTestsclass object - annotation: instance of the
Transactionalannotation
@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.
- rootDeclaringClass:
UserRepositoryTestsclass object - declaringClass:
RepositoryTestsclass object - annotation: instance of the
Transactionalannotation
@Transactional
@ContextConfiguration({"/test-datasource.xml", "/repository-config.xml"})
@Retention(RetentionPolicy.RUNTIME)
public @interface RepositoryTests { }
@RepositoryTests
public class UserRepositoryTests { }
- Since:
- 5.3
- Author:
- Sam Brannen
-
Method Summary
Modifier and TypeMethodDescriptionFind 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.Get the merged annotation for this descriptor.Class<?> Class<?> next()Find the nextTestContextAnnotationUtils.AnnotationDescriptorfor the specified annotation type in the hierarchy above the root declaring class of this descriptor.toString()Provide a textual representation of thisAnnotationDescriptor.
-
Method Details
-
getRootDeclaringClass
-
getDeclaringClass
-
getAnnotation
Get the merged annotation for this descriptor. -
next
Find the nextTestContextAnnotationUtils.AnnotationDescriptorfor 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.
- Returns:
- the next corresponding annotation descriptor if the annotation
was found; otherwise
null
-
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.- Returns:
- the set of all merged, synthesized
Annotationsfound, or an empty set if none were found
-
toString
-