Package org.testng.internal.annotations
Class JDK15AnnotationFinder
- java.lang.Object
-
- org.testng.internal.annotations.JDK15AnnotationFinder
-
- All Implemented Interfaces:
IAnnotationFinder
public class JDK15AnnotationFinder extends java.lang.Object implements IAnnotationFinder
This class implements IAnnotationFinder with JDK5 annotations
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.Class<? extends IAnnotation>,java.lang.Class<? extends java.lang.annotation.Annotation>>
m_annotationMap
private java.util.Map<Pair<java.lang.annotation.Annotation,?>,IAnnotation>
m_annotations
private JDK15TagFactory
m_tagFactory
private IAnnotationTransformer
m_transformer
-
Constructor Summary
Constructors Constructor Description JDK15AnnotationFinder(IAnnotationTransformer transformer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private <A extends IAnnotation>
AfindAnnotation(java.lang.Class<?> cls, java.lang.annotation.Annotation a, java.lang.Class<A> annotationClass, java.lang.Class<?> testClass, java.lang.reflect.Constructor<?> testConstructor, java.lang.reflect.Method testMethod, Pair<java.lang.annotation.Annotation,?> p, java.lang.Class<?> whichClass)
<A extends IAnnotation>
AfindAnnotation(java.lang.Class<?> cls, java.lang.Class<A> annotationClass)
<A extends IAnnotation>
AfindAnnotation(java.lang.Class<?> clazz, java.lang.reflect.Method m, java.lang.Class<A> annotationClass)
<A extends IAnnotation>
AfindAnnotation(java.lang.reflect.Constructor<?> cons, java.lang.Class<A> annotationClass)
<A extends IAnnotation>
AfindAnnotation(java.lang.reflect.Method m, java.lang.Class<A> annotationClass)
<A extends IAnnotation>
AfindAnnotation(ConstructorOrMethod com, java.lang.Class<A> annotationClass)
<A extends IAnnotation>
AfindAnnotation(ITestNGMethod tm, java.lang.Class<A> annotationClass)
private <A extends java.lang.annotation.Annotation>
AfindAnnotationInSuperClasses(java.lang.Class<?> cls, java.lang.Class<A> a)
java.lang.String[]
findOptionalValues(java.lang.reflect.Constructor<?> method)
java.lang.String[]
findOptionalValues(java.lang.reflect.Method method)
boolean
hasTestInstance(java.lang.reflect.Method method, int i)
private java.lang.String[]
optionalValues(java.lang.annotation.Annotation[][] annotations)
private void
transform(IAnnotation a, java.lang.Class<?> testClass, java.lang.reflect.Constructor<?> testConstructor, java.lang.reflect.Method testMethod, java.lang.Class<?> whichClass)
-
-
-
Field Detail
-
m_tagFactory
private final JDK15TagFactory m_tagFactory
-
m_annotationMap
private final java.util.Map<java.lang.Class<? extends IAnnotation>,java.lang.Class<? extends java.lang.annotation.Annotation>> m_annotationMap
-
m_annotations
private final java.util.Map<Pair<java.lang.annotation.Annotation,?>,IAnnotation> m_annotations
-
m_transformer
private final IAnnotationTransformer m_transformer
-
-
Constructor Detail
-
JDK15AnnotationFinder
public JDK15AnnotationFinder(IAnnotationTransformer transformer)
-
-
Method Detail
-
findAnnotationInSuperClasses
private <A extends java.lang.annotation.Annotation> A findAnnotationInSuperClasses(java.lang.Class<?> cls, java.lang.Class<A> a)
-
findAnnotation
public <A extends IAnnotation> A findAnnotation(java.lang.reflect.Method m, java.lang.Class<A> annotationClass)
- 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
public <A extends IAnnotation> A findAnnotation(java.lang.Class<?> clazz, java.lang.reflect.Method m, java.lang.Class<A> annotationClass)
- Specified by:
findAnnotation
in interfaceIAnnotationFinder
-
findAnnotation
public <A extends IAnnotation> A findAnnotation(ITestNGMethod tm, java.lang.Class<A> annotationClass)
- Specified by:
findAnnotation
in interfaceIAnnotationFinder
-
findAnnotation
public <A extends IAnnotation> A findAnnotation(ConstructorOrMethod com, java.lang.Class<A> annotationClass)
- Specified by:
findAnnotation
in interfaceIAnnotationFinder
-
transform
private void transform(IAnnotation a, java.lang.Class<?> testClass, java.lang.reflect.Constructor<?> testConstructor, java.lang.reflect.Method testMethod, java.lang.Class<?> whichClass)
-
findAnnotation
public <A extends IAnnotation> A findAnnotation(java.lang.Class<?> cls, java.lang.Class<A> annotationClass)
- 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
public <A extends IAnnotation> A findAnnotation(java.lang.reflect.Constructor<?> cons, java.lang.Class<A> annotationClass)
- 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.
-
findAnnotation
private <A extends IAnnotation> A findAnnotation(java.lang.Class<?> cls, java.lang.annotation.Annotation a, java.lang.Class<A> annotationClass, java.lang.Class<?> testClass, java.lang.reflect.Constructor<?> testConstructor, java.lang.reflect.Method testMethod, Pair<java.lang.annotation.Annotation,?> p, java.lang.Class<?> whichClass)
-
hasTestInstance
public boolean hasTestInstance(java.lang.reflect.Method method, int i)
- 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
public java.lang.String[] findOptionalValues(java.lang.reflect.Method method)
- 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
public java.lang.String[] findOptionalValues(java.lang.reflect.Constructor<?> method)
- 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
private java.lang.String[] optionalValues(java.lang.annotation.Annotation[][] annotations)
-
-