public class ClassUtils extends Object
Modifier and Type | Method and Description |
---|---|
static Class |
getClass(String clazz)
Return the specified class.
|
static VelMethod |
getMethod(String methodName,
Object[] params,
Class[] paramClasses,
Object o,
InternalContextAdapter context,
SimpleNode node,
boolean strictRef)
Lookup a VelMethod object given the method signature that is specified in
the passed in parameters.
|
static Object |
getNewInstance(String clazz)
Return a new instance of the given class.
|
static InputStream |
getResourceAsStream(Class claz,
String name)
Finds a resource with the given name.
|
public static Class getClass(String clazz) throws ClassNotFoundException
Class.forName( claz )
(which only calls the System class
loader) when the class might be in a different classloader (e.g. in a
webapp).clazz
- the name of the class to instantiateClassNotFoundException
public static Object getNewInstance(String clazz) throws ClassNotFoundException, IllegalAccessException, InstantiationException
Class.forName( claz ).newInstance()
(which only
calls the System class loader) when the class might be in a different
classloader (e.g. in a webapp).clazz
- the name of the class to instantiateClassNotFoundException
IllegalAccessException
InstantiationException
public static InputStream getResourceAsStream(Class claz, String name)
Class.getResourceAsString
when the resource
might come from a different classloader. (e.g. a webapp).claz
- Class to use when getting the System classloader (used if no Thread
Context classloader available or fails to get resource).name
- name of the resourcepublic static VelMethod getMethod(String methodName, Object[] params, Class[] paramClasses, Object o, InternalContextAdapter context, SimpleNode node, boolean strictRef)
methodName
- Name of methodparams
- Array of objects that are parameters to the methodparamClasses
- Array of Classes corresponding to the types in params.o
- Object to introspect for the given method.context
- Context from which the method cache is acquirednode
- ASTNode, used for error reporting.strictRef
- If no method is found, throw an exception, never return null in this caseCopyright © 2000–2020 The Apache Software Foundation. All rights reserved.