Package org.testng.internal.annotations
Class AnnotationHelper
- java.lang.Object
-
- org.testng.internal.annotations.AnnotationHelper
-
public class AnnotationHelper extends java.lang.Object
Helper methods to find @Test and @Configuration tags. They minimize the amount of casting we need to do.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.List<java.lang.Class<? extends IAnnotation>>
ALL_ANNOTATIONS
private static java.util.List<java.lang.Class<? extends IAnnotation>>
CONFIGURATION_CLASSES
private static Logger
LOGGER
private static java.lang.String
SUFFIX
-
Constructor Summary
Constructors Modifier Constructor Description private
AnnotationHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static IConfigurationAnnotation
createConfiguration(IConfigurationAnnotation bs, IConfigurationAnnotation as, IConfigurationAnnotation bt, IConfigurationAnnotation at, IConfigurationAnnotation bg, IConfigurationAnnotation ag, IConfigurationAnnotation bc, IConfigurationAnnotation ac, IConfigurationAnnotation bm, IConfigurationAnnotation am)
private static java.lang.String
createMethodKey(java.lang.reflect.Method m)
static <A extends java.lang.annotation.Annotation>
AfindAnnotationSuperClasses(java.lang.Class<A> annotationClass, java.lang.Class<?> parameterClass)
static IConfigurationAnnotation
findConfiguration(IAnnotationFinder finder, java.lang.reflect.Method m)
static IConfigurationAnnotation
findConfiguration(IAnnotationFinder finder, ConstructorOrMethod m)
static IFactoryAnnotation
findFactory(IAnnotationFinder finder, java.lang.reflect.Constructor c)
static IFactoryAnnotation
findFactory(IAnnotationFinder finder, java.lang.reflect.Method m)
static ITestNGMethod[]
findMethodsWithAnnotation(java.lang.Class<?> rootClass, java.lang.Class<? extends IAnnotation> annotationClass, IAnnotationFinder annotationFinder, XmlTest xmlTest)
Delegation method for creating the list ofITestMethod
s to be analysed.static ITestAnnotation
findTest(IAnnotationFinder finder, java.lang.Class<?> cls)
static ITestAnnotation
findTest(IAnnotationFinder finder, java.lang.reflect.Method m)
static ITestAnnotation
findTest(IAnnotationFinder finder, ITestNGMethod m)
private static void
finishInitialize(ConfigurationAnnotation result, IConfigurationAnnotation bs)
static java.util.List<java.lang.Class<? extends IAnnotation>>
getAllAnnotations()
(package private) static <A extends java.lang.annotation.Annotation>
AgetAnnotationFromClass(java.lang.Class<?> clazz, java.lang.Class<A> a)
(package private) static <A extends java.lang.annotation.Annotation>
AgetAnnotationFromConstructor(java.lang.reflect.Constructor<?> c, java.lang.Class<A> a)
(package private) static <A extends java.lang.annotation.Annotation>
AgetAnnotationFromMethod(java.lang.reflect.Method method, java.lang.Class<A> a)
private static boolean
isAnnotationPresent(IAnnotationFinder annotationFinder, java.lang.Class<?> cls, java.lang.Class<? extends IAnnotation> annotationClass)
private static boolean
isAnnotationPresent(IAnnotationFinder annotationFinder, java.lang.reflect.Method m)
private static boolean
isAnnotationPresent(IAnnotationFinder annotationFinder, java.lang.reflect.Method m, java.lang.Class<? extends IAnnotation> annotationClass)
-
-
-
Field Detail
-
LOGGER
private static final Logger LOGGER
-
SUFFIX
private static final java.lang.String SUFFIX
- See Also:
- Constant Field Values
-
ALL_ANNOTATIONS
private static final java.util.List<java.lang.Class<? extends IAnnotation>> ALL_ANNOTATIONS
-
CONFIGURATION_CLASSES
private static final java.util.List<java.lang.Class<? extends IAnnotation>> CONFIGURATION_CLASSES
-
-
Method Detail
-
findTest
public static ITestAnnotation findTest(IAnnotationFinder finder, java.lang.Class<?> cls)
-
findTest
public static ITestAnnotation findTest(IAnnotationFinder finder, java.lang.reflect.Method m)
-
findTest
public static ITestAnnotation findTest(IAnnotationFinder finder, ITestNGMethod m)
-
findFactory
public static IFactoryAnnotation findFactory(IAnnotationFinder finder, java.lang.reflect.Method m)
-
findFactory
public static IFactoryAnnotation findFactory(IAnnotationFinder finder, java.lang.reflect.Constructor c)
-
findConfiguration
public static IConfigurationAnnotation findConfiguration(IAnnotationFinder finder, ConstructorOrMethod m)
-
findConfiguration
public static IConfigurationAnnotation findConfiguration(IAnnotationFinder finder, java.lang.reflect.Method m)
-
createConfiguration
private static IConfigurationAnnotation createConfiguration(IConfigurationAnnotation bs, IConfigurationAnnotation as, IConfigurationAnnotation bt, IConfigurationAnnotation at, IConfigurationAnnotation bg, IConfigurationAnnotation ag, IConfigurationAnnotation bc, IConfigurationAnnotation ac, IConfigurationAnnotation bm, IConfigurationAnnotation am)
-
finishInitialize
private static void finishInitialize(ConfigurationAnnotation result, IConfigurationAnnotation bs)
-
getAllAnnotations
public static java.util.List<java.lang.Class<? extends IAnnotation>> getAllAnnotations()
-
findMethodsWithAnnotation
public static ITestNGMethod[] findMethodsWithAnnotation(java.lang.Class<?> rootClass, java.lang.Class<? extends IAnnotation> annotationClass, IAnnotationFinder annotationFinder, XmlTest xmlTest)
Delegation method for creating the list ofITestMethod
s to be analysed.
-
findAnnotationSuperClasses
public static <A extends java.lang.annotation.Annotation> A findAnnotationSuperClasses(java.lang.Class<A> annotationClass, java.lang.Class<?> parameterClass)
-
isAnnotationPresent
private static boolean isAnnotationPresent(IAnnotationFinder annotationFinder, java.lang.reflect.Method m)
-
isAnnotationPresent
private static boolean isAnnotationPresent(IAnnotationFinder annotationFinder, java.lang.reflect.Method m, java.lang.Class<? extends IAnnotation> annotationClass)
-
isAnnotationPresent
private static boolean isAnnotationPresent(IAnnotationFinder annotationFinder, java.lang.Class<?> cls, java.lang.Class<? extends IAnnotation> annotationClass)
-
createMethodKey
private static java.lang.String createMethodKey(java.lang.reflect.Method m)
- Returns:
- A hashcode representing the name of this method and its parameters, but without its class
-
getAnnotationFromClass
static <A extends java.lang.annotation.Annotation> A getAnnotationFromClass(java.lang.Class<?> clazz, java.lang.Class<A> a)
-
getAnnotationFromMethod
static <A extends java.lang.annotation.Annotation> A getAnnotationFromMethod(java.lang.reflect.Method method, java.lang.Class<A> a)
-
getAnnotationFromConstructor
static <A extends java.lang.annotation.Annotation> A getAnnotationFromConstructor(java.lang.reflect.Constructor<?> c, java.lang.Class<A> a)
-
-