Package org.testng.internal.annotations
Class JDK15AnnotationFinder
java.lang.Object
org.testng.internal.annotations.JDK15AnnotationFinder
- All Implemented Interfaces:
IAnnotationFinder
This class implements IAnnotationFinder with JDK5 annotations
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<Class<? extends IAnnotation>,
Class<? extends Annotation>> private final Map<Pair<Annotation,
?>, IAnnotation> private final JDK15TagFactory
private final IAnnotationTransformer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate <A extends IAnnotation>
AfindAnnotation
(Class<?> cls, Annotation a, Class<A> annotationClass, Class<?> testClass, Constructor<?> testConstructor, Method testMethod, Pair<Annotation, ?> p, Class<?> whichClass) <A extends IAnnotation>
AfindAnnotation
(Class<?> cls, Class<A> annotationClass) <A extends IAnnotation>
AfindAnnotation
(Class<?> clazz, Method m, Class<A> annotationClass) <A extends IAnnotation>
AfindAnnotation
(Constructor<?> cons, Class<A> annotationClass) <A extends IAnnotation>
AfindAnnotation
(Method m, Class<A> annotationClass) <A extends IAnnotation>
AfindAnnotation
(ConstructorOrMethod com, Class<A> annotationClass) <A extends IAnnotation>
AfindAnnotation
(ITestNGMethod tm, Class<A> annotationClass) private <A extends Annotation>
AfindAnnotationInSuperClasses
(Class<?> cls, Class<A> a) <A extends IAnnotation>
List<A>findInheritedAnnotations
(Class<?> cls, Class<A> annotationClass) String[]
findOptionalValues
(Constructor<?> method) String[]
findOptionalValues
(Method method) private <A extends IAnnotation>
voidfindSuperInterface
(Class<?> cls, Class<?> inter, Class<A> annotationClass, Class<? extends Annotation> a, List<A> annotations) boolean
hasTestInstance
(Method method, int i) private String[]
optionalValues
(Annotation[][] annotations) private void
transform
(IAnnotation a, Class<?> testClass, Constructor<?> testConstructor, Method testMethod, Class<?> whichClass)
-
Field Details
-
m_tagFactory
-
m_annotationMap
-
m_annotations
-
m_transformer
-
-
Constructor Details
-
JDK15AnnotationFinder
-
-
Method Details
-
findAnnotationInSuperClasses
-
findAnnotation
- Specified by:
findAnnotation
in interfaceIAnnotationFinder
- Type Parameters:
A
- The expectedIAnnotation
type- Parameters:
m
- - The correspondingMethod
annotationClass
- - The class on which annotation is to be looked for.- Returns:
- The annotation on the method. If not found, return the annotation on the declaring class. If not found, return null.
-
findAnnotation
- Specified by:
findAnnotation
in interfaceIAnnotationFinder
-
findAnnotation
- Specified by:
findAnnotation
in interfaceIAnnotationFinder
-
findAnnotation
- Specified by:
findAnnotation
in interfaceIAnnotationFinder
-
transform
private void transform(IAnnotation a, Class<?> testClass, Constructor<?> testConstructor, Method testMethod, Class<?> whichClass) -
findAnnotation
- Specified by:
findAnnotation
in interfaceIAnnotationFinder
- Type Parameters:
A
- The expectedIAnnotation
type- Parameters:
cls
- - The corresponding class.annotationClass
- - The class on which annotation is to be looked for.- Returns:
- The annotation on the class or null if none found.
-
findAnnotation
- Specified by:
findAnnotation
in interfaceIAnnotationFinder
- Type Parameters:
A
- The expectedIAnnotation
type- Parameters:
cons
- - The correspondingConstructor
annotationClass
- - The class on which annotation is to be looked for.- Returns:
- The annotation on the method. If not found, return the annotation on the declaring class. If not found, return null.
-
findInheritedAnnotations
public <A extends IAnnotation> List<A> findInheritedAnnotations(Class<?> cls, Class<A> annotationClass) - Specified by:
findInheritedAnnotations
in interfaceIAnnotationFinder
- Type Parameters:
A
- - The expectedIAnnotation
type- Parameters:
cls
- - The corresponding class.annotationClass
- - The class on which annotation is to be looked for.- Returns:
- The annotations on the inherited interfaces. If not found, return the annotations on the declaring interface. If not found, return an empty list.
-
findSuperInterface
private <A extends IAnnotation> void findSuperInterface(Class<?> cls, Class<?> inter, Class<A> annotationClass, Class<? extends Annotation> a, List<A> annotations) -
findAnnotation
private <A extends IAnnotation> A findAnnotation(Class<?> cls, Annotation a, Class<A> annotationClass, Class<?> testClass, Constructor<?> testConstructor, Method testMethod, Pair<Annotation, ?> p, Class<?> whichClass) -
hasTestInstance
- Specified by:
hasTestInstance
in interfaceIAnnotationFinder
- Parameters:
method
- TheMethod
i
- The parameter index- Returns:
- true if the ith parameter of the given method has the annotation @TestInstance.
-
findOptionalValues
- Specified by:
findOptionalValues
in interfaceIAnnotationFinder
- Parameters:
method
- TheMethod
- Returns:
- the @Optional values of this method's parameters (
null
if the parameter isn't optional)
-
findOptionalValues
- Specified by:
findOptionalValues
in interfaceIAnnotationFinder
- Parameters:
method
- TheConstructor
- Returns:
- the @Optional values of this method's parameters (
null
if the parameter isn't optional)
-
optionalValues
-