public final class ClassHelper extends Object
Modifier and Type | Method and Description |
---|---|
static void |
addClassLoader(ClassLoader loader)
Add a class loader to the searchable loaders.
|
static Object |
createInstance(Class<?> declaringClass,
Map<Class<?>,IClass> classes,
XmlTest xmlTest,
IAnnotationFinder finder,
ITestObjectFactory objectFactory,
boolean create)
Deprecated.
- This method is deprecated as of TestNG 7.0.0
|
static Object |
createInstance1(Class<?> declaringClass,
Map<Class<?>,IClass> classes,
XmlTest xmlTest,
IAnnotationFinder finder,
IObjectFactory factory,
boolean create)
Deprecated.
- This method is deprecated as of TestNG 7.0.0
|
static IMethodSelector |
createSelector(XmlMethodSelector selector)
Deprecated.
- This method is deprecated as of TestNG 7.0.0
|
static IJUnitTestRunner |
createTestRunner(TestRunner runner)
Deprecated.
- This method is deprecated as of TestNG 7.0.0
|
static Class<?> |
fileToClass(String file)
Returns the Class object corresponding to the given name.
|
static XmlClass[] |
findClassesInSameTest(Class<?> cls,
XmlSuite suite) |
static List<ConstructorOrMethod> |
findDeclaredFactoryMethods(Class<?> cls,
IAnnotationFinder finder)
For the given class, returns the method annotated with @Factory or null if none is found.
|
static Class<?> |
forName(String className)
Tries to load the specified class using the context ClassLoader or if none, than from the
default ClassLoader.
|
static Set<Method> |
getAvailableMethods(Class<?> clazz)
Extract all callable methods of a class and all its super (keeping in mind the Java access
rules).
|
static <T> T |
newInstance(Class<T> clazz)
Deprecated.
- This method is deprecated as of TestNG 7.0.0
|
static <T> T |
newInstance(Constructor<T> constructor,
Object... parameters)
Deprecated.
- This method is deprecated as of TestNG 7.0.0
|
static <T> T |
newInstanceOrNull(Class<T> clazz)
Deprecated.
- This method is deprecated as of TestNG 7.0.0
|
static <T> T |
tryOtherConstructor(Class<T> declaringClass) |
public static void addClassLoader(ClassLoader loader)
@Deprecated public static <T> T newInstance(Class<T> clazz)
@Deprecated public static <T> T newInstanceOrNull(Class<T> clazz)
@Deprecated public static <T> T newInstance(Constructor<T> constructor, Object... parameters)
public static Class<?> forName(String className)
className
- the class name to be loaded.public static List<ConstructorOrMethod> findDeclaredFactoryMethods(Class<?> cls, IAnnotationFinder finder)
cls
- The class to search for the @Factory annotation.finder
- The finder (JDK 1.4 or JDK 5.0+) use to search for the annotation.methods
public static Set<Method> getAvailableMethods(Class<?> clazz)
@Deprecated public static IJUnitTestRunner createTestRunner(TestRunner runner)
@Deprecated public static IMethodSelector createSelector(XmlMethodSelector selector)
@Deprecated public static Object createInstance(Class<?> declaringClass, Map<Class<?>,IClass> classes, XmlTest xmlTest, IAnnotationFinder finder, ITestObjectFactory objectFactory, boolean create)
@Deprecated public static Object createInstance1(Class<?> declaringClass, Map<Class<?>,IClass> classes, XmlTest xmlTest, IAnnotationFinder finder, IObjectFactory factory, boolean create)
public static <T> T tryOtherConstructor(Class<T> declaringClass)
public static Class<?> fileToClass(String file)
file
- the class name.