|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.yajul.util.ReflectionUtil
public class ReflectionUtil
Reflection utilities. User: josh Date: Nov 16, 2003 Time: 4:45:36 PM
Constructor Summary | |
---|---|
ReflectionUtil()
|
Method Summary | ||
---|---|---|
static java.lang.Object |
createInstance(java.lang.String className)
Creates a new instance of the class, throwing an initialization error, if there was a problem. |
|
static
|
createInstance(java.lang.String className,
java.lang.Class<T> componentType)
Type checked version of create instance using the default class loader. |
|
static java.lang.Object |
createInstance(java.lang.String className,
java.lang.ClassLoader loader)
Creates a new instance of the class using the specified loader. |
|
static java.lang.String |
filenameToClassname(java.lang.String filename)
Turns a class file name into a class name. |
|
static java.net.URL |
findClassURL(java.lang.Class c)
Returns the URL where the specified class is located in the current classpath. |
|
static java.lang.String |
getClassResourceName(java.lang.Class c)
Returns the resource name for the specified class. |
|
static java.util.Map<java.lang.Integer,java.lang.String> |
getConstantNameMap(java.lang.Class c)
Returns a map of (Integer->String) from the values of any static integer constants in the class. |
|
static java.lang.ClassLoader |
getCurrentClassLoader()
|
|
static java.lang.String |
getterPropertyName(java.lang.reflect.Method method)
Returns the name of the property IFF the method is a property getter, or null if the method is not a getter. |
|
static boolean |
isPropertyGetter(java.lang.reflect.Method method)
Returns true if the method is a property getter. |
|
static java.lang.String |
setterPropertyName(java.lang.reflect.Method method)
Returns the name of the property IFF the method is a property setter, or null if the method is not a setter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReflectionUtil()
Method Detail |
---|
public static java.util.Map<java.lang.Integer,java.lang.String> getConstantNameMap(java.lang.Class c)
c
- The class to get the constants from.
public static boolean isPropertyGetter(java.lang.reflect.Method method)
method
- The method.
public static java.lang.String getterPropertyName(java.lang.reflect.Method method)
method
- The method.
public static java.lang.String setterPropertyName(java.lang.reflect.Method method)
method
- The method.
public static java.lang.ClassLoader getCurrentClassLoader()
public static java.lang.Object createInstance(java.lang.String className, java.lang.ClassLoader loader)
className
- The class to instatiate - if null a default will be usedloader
- The class loader to use when obtaining the instance
public static java.lang.Object createInstance(java.lang.String className)
className
- The class name
public static <T> T createInstance(java.lang.String className, java.lang.Class<T> componentType)
className
- the class namecomponentType
- the type of the instance (e.g. an interface)
public static java.lang.String getClassResourceName(java.lang.Class c)
c
- The class.
public static java.net.URL findClassURL(java.lang.Class c)
c
- The class to look for.
public static java.lang.String filenameToClassname(java.lang.String filename)
filename
- the file name
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |