Top Description Methods
org.testng.internal.annotations

public Interface IAnnotationFinder

Known Direct Implementers
org.testng.internal.annotations.JDK15AnnotationFinder
Imports
java.lang.reflect.Constructor, .Method, java.util.List, org.testng.ITestNGMethod, org.testng.annotations.IAnnotation, org.testng.internal.ConstructorOrMethod

This interface defines how annotations are found on classes, methods and constructors. It will be implemented by both JDK 1.4 and JDK 5 annotation finders.

Method Summary

Modifier and TypeMethod and Description
public <
The expected IAnnotation type
A extends IAnnotation
>
A

Returns:

The annotation on the class or null if none found.
findAnnotation
(Class<?>
- The corresponding class.
cls
,
Class<A>
- The class on which annotation is to be looked for.
annotationClass
)

public <
The expected IAnnotation type
A extends IAnnotation
>
A

Returns:

The annotation on the method. If not found, return the annotation on the declaring class. If not found, return null.
findAnnotation
(Method
- The corresponding Method
m
,
Class<A>
- The class on which annotation is to be looked for.
annotationClass
)

public <A extends IAnnotation> A
findAnnotation(ITestNGMethod m, Class<A> annotationClass)

public <A extends IAnnotation> A
findAnnotation(ConstructorOrMethod com, Class<A> annotationClass)

public <A extends IAnnotation> A
findAnnotation(Class<?> clazz, Method m, Class<A> annotationClass)

public <
The expected IAnnotation type
A extends IAnnotation
>
A

Returns:

The annotation on the method. If not found, return the annotation on the declaring class. If not found, return null.
findAnnotation
(Constructor<?>
- The corresponding Constructor
cons
,
Class<A>
- The class on which annotation is to be looked for.
annotationClass
)

public <
- The expected IAnnotation type
A extends IAnnotation
>
List<A>

Returns:

The annotations on the inherited interfaces. If not found, return the annotations on the declaring interface. If not found, return an empty list.
findInheritedAnnotations
(Class<?>
- The corresponding class.
cls
,
Class<A>
- The class on which annotation is to be looked for.
annotationClass
)

public String[]

Returns:

the @Optional values of this method's parameters (null if the parameter isn't optional)
findOptionalValues
(Method
The Method
method
)

public String[]

Returns:

the @Optional values of this method's parameters (null if the parameter isn't optional)
findOptionalValues
(Constructor<?>
The Constructor
ctor
)

public boolean

Returns:

true if the ith parameter of the given method has the annotation @TestInstance.
hasTestInstance
(Method
The Method
method
,
int
The parameter index
i
)

Method Detail

findAnnotationback to summary
public <A extends IAnnotation> A findAnnotation(Class<?> cls, Class<A> annotationClass)
Parameters
<A>
The expected IAnnotation type
cls:Class<?>

- The corresponding class.

annotationClass:Class<A>

- The class on which annotation is to be looked for.

Returns:A

The annotation on the class or null if none found.

findAnnotationback to summary
public <A extends IAnnotation> A findAnnotation(Method m, Class<A> annotationClass)
Parameters
<A>
The expected IAnnotation type
m:Method

- The corresponding Method

annotationClass:Class<A>

- The class on which annotation is to be looked for.

Returns:A

The annotation on the method. If not found, return the annotation on the declaring class. If not found, return null.

findAnnotationback to summary
public <A extends IAnnotation> A findAnnotation(ITestNGMethod m, Class<A> annotationClass)
findAnnotationback to summary
public <A extends IAnnotation> A findAnnotation(ConstructorOrMethod com, Class<A> annotationClass)
findAnnotationback to summary
public <A extends IAnnotation> A findAnnotation(Class<?> clazz, Method m, Class<A> annotationClass)
findAnnotationback to summary
public <A extends IAnnotation> A findAnnotation(Constructor<?> cons, Class<A> annotationClass)
Parameters
<A>
The expected IAnnotation type
cons:Constructor<?>

- The corresponding Constructor

annotationClass:Class<A>

- The class on which annotation is to be looked for.

Returns:A

The annotation on the method. If not found, return the annotation on the declaring class. If not found, return null.

findInheritedAnnotationsback to summary
public <A extends IAnnotation> List<A> findInheritedAnnotations(Class<?> cls, Class<A> annotationClass)
Parameters
<A>
- The expected IAnnotation type
cls:Class<?>

- The corresponding class.

annotationClass:Class<A>

- The class on which annotation is to be looked for.

Returns:List<A>

The annotations on the inherited interfaces. If not found, return the annotations on the declaring interface. If not found, return an empty list.

findOptionalValuesback to summary
public String[] findOptionalValues(Method method)
Parameters
method:Method

The Method

Returns:String[]

the @Optional values of this method's parameters (null if the parameter isn't optional)

findOptionalValuesback to summary
public String[] findOptionalValues(Constructor<?> ctor)
Parameters
ctor:Constructor<?>

The Constructor

Returns:String[]

the @Optional values of this method's parameters (null if the parameter isn't optional)

hasTestInstanceback to summary
public boolean hasTestInstance(Method method, int i)
Parameters
method:Method

The Method

i:int

The parameter index

Returns:boolean

true if the ith parameter of the given method has the annotation @TestInstance.