|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.jersey.core.reflection.ReflectionHelper
public class ReflectionHelper
Utility methods for Java reflection.
| Nested Class Summary | |
|---|---|
static class |
ReflectionHelper.ClassTypePair
A tuple consisting of a class and type of the class. |
| Constructor Summary | |
|---|---|
ReflectionHelper()
|
|
| Method Summary | |
|---|---|
static java.lang.Class |
classForName(java.lang.String name)
Get the Class from the class name. |
static java.lang.Class |
classForName(java.lang.String name,
java.lang.ClassLoader cl)
Get the Class from the class name. |
static java.lang.Class |
classForNameWithException(java.lang.String name)
Get the Class from the class name. |
static java.lang.Class |
classForNameWithException(java.lang.String name,
java.lang.ClassLoader cl)
Get the Class from the class name. |
static java.lang.ClassLoader |
getContextClassLoader()
Get the context class loader. |
static java.lang.Class |
getGenericClass(java.lang.reflect.Type parameterizedType)
Get the class that is the type argument of a parameterized type. |
static java.lang.reflect.Constructor |
getStringConstructor(java.lang.Class c)
Get the constructor that has a single parameter of String. |
static java.lang.reflect.Method |
getValueOfStringMethod(java.lang.Class c)
Get the static valueOf(String ) method. |
static ReflectionHelper.ClassTypePair |
resolveTypeVariable(java.lang.Class c,
java.lang.Class dc,
java.lang.reflect.TypeVariable tv)
Given a type variable resolve the Java class of that variable. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReflectionHelper()
| Method Detail |
|---|
public static java.lang.Class classForName(java.lang.String name)
The context class loader will be utilized if accessible and non-null. Otherwise the defining class loader of this class will be utilized.
name - the class name.
public static java.lang.Class classForName(java.lang.String name,
java.lang.ClassLoader cl)
name - the class name.cl - the class loader to use, if null then the defining class loader
of this class will be utilized.
public static java.lang.Class classForNameWithException(java.lang.String name)
throws java.lang.ClassNotFoundException
The context class loader will be utilized if accessible and non-null. Otherwise the the defining class loader of this class will be utilized.
name - the class name.
java.lang.ClassNotFoundException - if the class cannot be found.
public static java.lang.Class classForNameWithException(java.lang.String name,
java.lang.ClassLoader cl)
throws java.lang.ClassNotFoundException
name - the class name.cl - the class loader to use, if null then the defining class loader
of this class will be utilized.
java.lang.ClassNotFoundException - if the class cannot be found.public static java.lang.ClassLoader getContextClassLoader()
public static java.lang.Class getGenericClass(java.lang.reflect.Type parameterizedType)
throws java.lang.IllegalArgumentException
parameterizedType - must be an instance of ParameterizedType
and have exactly one type argument.
java.lang.IllegalArgumentException - if the single type argument is not of
a class or a generic array type, or the generic component type
of the generic array type is not class.public static java.lang.reflect.Method getValueOfStringMethod(java.lang.Class c)
c - The class to obtain the method.
public static java.lang.reflect.Constructor getStringConstructor(java.lang.Class c)
c - The class to obtain the constructor.
public static ReflectionHelper.ClassTypePair resolveTypeVariable(java.lang.Class c,
java.lang.Class dc,
java.lang.reflect.TypeVariable tv)
c - the concrete class from which all type variables are resolveddc - the declaring class where the type variable was definedtv - the type variable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||