|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.velocity.tools.ClassUtils
public class ClassUtils
Repository for common class and reflection methods.
Field Summary | |
---|---|
static ClassUtils |
INSTANCE
|
Method Summary | |
---|---|
static Method |
findDeclaredMethod(Class clazz,
String name,
Class[] params)
|
static Method |
findMethod(Class clazz,
String name,
Class[] params)
|
static Class |
getClass(String name)
Load a class with a given name. |
static Object |
getFieldValue(Class clazz,
String fieldname)
|
static Object |
getFieldValue(String fieldPath)
|
ClassUtils |
getInstance()
|
static Object |
getInstance(String classname)
|
static Iterator |
getIterator(Object obj)
Retrieves an Iterator from or creates and Iterator for the specified object. |
static URL |
getResource(String name,
Object caller)
Load a given resource. |
static InputStream |
getResourceAsStream(String name,
Object caller)
This is a convenience method to load a resource as a stream. |
static List<URL> |
getResources(String name,
Object caller)
Load all resources with the specified name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final ClassUtils INSTANCE
Method Detail |
---|
public ClassUtils getInstance()
public static Class getClass(String name) throws ClassNotFoundException
Thread
.currentThread().getContextClassLoader()
Class.forName(java.lang.String)
ClassUtils
.class.getClassLoader()
name
- Fully qualified class name to be loaded
ClassNotFoundException
- if the class cannot be foundpublic static Object getInstance(String classname) throws ClassNotFoundException, IllegalAccessException, InstantiationException
ClassNotFoundException
IllegalAccessException
InstantiationException
public static List<URL> getResources(String name, Object caller)
ClassUtils
.class.getClassLoader().getResources(name)ClassUtils
.class.getResource(name)getCallerLoader(Object caller)
.getResources(name)
name
- The name of the resources to loadcaller
- The instance or Class
calling this methodpublic static URL getResource(String name, Object caller)
ClassUtils
.class.getClassLoader().getResource(name)ClassUtils
.class.getResource(name)
name
- The name of the resource to loadcaller
- The instance or Class
calling this methodpublic static InputStream getResourceAsStream(String name, Object caller)
name
- The name of the resource to loadcaller
- The instance or Class
calling this methodpublic static Method findMethod(Class clazz, String name, Class[] params) throws SecurityException
SecurityException
public static Method findDeclaredMethod(Class clazz, String name, Class[] params) throws SecurityException
SecurityException
public static Object getFieldValue(String fieldPath) throws ClassNotFoundException, NoSuchFieldException, SecurityException, IllegalAccessException
ClassNotFoundException
NoSuchFieldException
SecurityException
IllegalAccessException
public static Object getFieldValue(Class clazz, String fieldname) throws NoSuchFieldException, SecurityException, IllegalAccessException
NoSuchFieldException
SecurityException
IllegalAccessException
public static Iterator getIterator(Object obj) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException
NoSuchMethodException
IllegalAccessException
InvocationTargetException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |