|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjd.util.ClassUtil
A collection of class utility functions.
Constructor Summary | |
ClassUtil()
|
Method Summary | |
static Class |
classForName(String className)
A replacement for Class.forName. |
static String |
getClassName(Class c)
Return the name of a class without the package prefix. |
static String |
getClassName(Object object)
Return the name of the class of an object without the package prefix. |
static String |
getPackageName(Class c)
Return package prefix of a class name. |
static String |
getPackageName(Object object)
Return package prefix of a class name. |
static Object |
newInstance(Class c,
Object parameter)
Create a new instance of a class calling a constructor with one argument. |
static Object |
newInstance(Class c,
Object[] parameters)
Create a new instance of a class calling a constructor with several arguments. |
static Object |
newInstance(String className)
Create a new instance of a class. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ClassUtil()
Method Detail |
public static Class classForName(String className) throws ClassNotFoundException
ClassNotFoundException
public static Object newInstance(String className) throws InstantiationException, IllegalAccessException, ClassNotFoundException
className
- the name of the class
InstantiationException
- all possible exceptions are converted
to a InstantiationException
IllegalAccessException
ClassNotFoundException
public static Object newInstance(Class c, Object parameter) throws InvocationTargetException, InstantiationException
c
- the Classparameter
- the constructor parameter.
InvocationTargetException
InstantiationException
public static Object newInstance(Class c, Object[] parameters) throws InstantiationException, InvocationTargetException
parameters
- an array of constructor parameters.
InstantiationException
InvocationTargetException
public static String getClassName(Object object)
public static String getClassName(Class c)
public static String getPackageName(Object object)
public static String getPackageName(Class c)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |