|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.commons.lang.ClassUtils
org.mule.util.ClassUtils
This class is useful for loading resources and classes in a fault tolerant manner that works across different applications servers. The resource and classloading methods are SecurityManager friendly.
| Field Summary | |
static Object[] |
NO_ARGS
|
| Constructor Summary | |
ClassUtils()
|
|
| Method Summary | |
static boolean |
compare(Class[] c1,
Class[] c2,
boolean matchOnObject)
|
static String |
getClassName(Class clazz)
|
static Class[] |
getClassTypes(Object object)
Used for creating an array of class types for an array or single object |
static Constructor |
getConstructor(Class clazz,
Class[] paramTypes)
|
static Method |
getMethod(String name,
Class[] parameterTypes,
Class clazz)
Returns a matching method for the given name and parameters on the given class If the parameterTypes arguments is null it will return the first matching method on the class |
static Class[] |
getParameterTypes(Object bean,
String methodName)
|
static URL |
getResource(String resourceName,
Class callingClass)
Load a given resource. |
static Enumeration |
getResources(String resourceName,
Class callingClass)
|
static List |
getSatisfiableMethods(Class implementation,
Class[] parameterTypes,
boolean voidOk,
boolean matchOnObject,
String[] ignoreMethods)
A helper method that will find all matching methods on a class with the given parameter type |
static Object |
instanciateClass(Class clazz,
Object[] constructorArgs)
|
static Object |
instanciateClass(String name,
Object[] constructorArgs)
|
static Object |
instanciateClass(String name,
Object[] constructorArgs,
Class callingClass)
|
static boolean |
isClassOnPath(String className,
Class currentClass)
Can be used by serice endpoints to select which service to use based on what's loaded on the classpath |
static boolean |
isConcrete(Class clazz)
|
static Class |
loadClass(String className,
Class callingClass)
Load a class with a given name. |
static void |
printClassLoader()
Prints the current classloader hierarchy - useful for debugging. |
static void |
printClassLoader(ClassLoader cl)
Prints the classloader hierarchy from a given classloader - useful for debugging. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final Object[] NO_ARGS
| Constructor Detail |
public ClassUtils()
| Method Detail |
public static boolean isConcrete(Class clazz)
public static URL getResource(String resourceName,
Class callingClass)
Thread.currentThread().getContextClassLoader()
ClassLoaderUtil.class.getClassLoader()
callingClass.getClassLoader()
resourceName - The name of the resource to loadcallingClass - The Class object of the calling object
public static Enumeration getResources(String resourceName,
Class callingClass)
public static Class loadClass(String className,
Class callingClass)
throws ClassNotFoundException
Thread.currentThread().getContextClassLoader()
Class.forName(java.lang.String)
ClassLoaderUtil.class.getClassLoader()
callingClass.getClassLoader()
className - The name of the class to loadcallingClass - The Class object of the calling object
ClassNotFoundException - If the class cannot be found anywhere.public static void printClassLoader()
public static void printClassLoader(ClassLoader cl)
public static Object instanciateClass(Class clazz,
Object[] constructorArgs)
throws SecurityException,
NoSuchMethodException,
IllegalArgumentException,
InstantiationException,
IllegalAccessException,
InvocationTargetException
SecurityException
NoSuchMethodException
IllegalArgumentException
InstantiationException
IllegalAccessException
InvocationTargetException
public static Object instanciateClass(String name,
Object[] constructorArgs)
throws ClassNotFoundException,
SecurityException,
NoSuchMethodException,
IllegalArgumentException,
InstantiationException,
IllegalAccessException,
InvocationTargetException
ClassNotFoundException
SecurityException
NoSuchMethodException
IllegalArgumentException
InstantiationException
IllegalAccessException
InvocationTargetException
public static Object instanciateClass(String name,
Object[] constructorArgs,
Class callingClass)
throws ClassNotFoundException,
SecurityException,
NoSuchMethodException,
IllegalArgumentException,
InstantiationException,
IllegalAccessException,
InvocationTargetException
ClassNotFoundException
SecurityException
NoSuchMethodException
IllegalArgumentException
InstantiationException
IllegalAccessException
InvocationTargetException
public static Class[] getParameterTypes(Object bean,
String methodName)
public static Method getMethod(String name,
Class[] parameterTypes,
Class clazz)
name - the method name to findparameterTypes - an array of argument types or nullclazz - the class to find the method on
public static Constructor getConstructor(Class clazz,
Class[] paramTypes)
public static List getSatisfiableMethods(Class implementation,
Class[] parameterTypes,
boolean voidOk,
boolean matchOnObject,
String[] ignoreMethods)
implementation - the class to build methods onparameterTypes - the argument param types to look forvoidOk - whether void methods shouldbe included in the found listmatchOnObject - Determines whether parameters of OBject type are matched
when they are of Object.class typeignoreMethods - An array of method names to ignore. Often 'equals' is not
a desired match. This argument can be null.
public static boolean isClassOnPath(String className,
Class currentClass)
className - The class name to look forcurrentClass - the calling class
public static Class[] getClassTypes(Object object)
object - single object or array
public static String getClassName(Class clazz)
public static boolean compare(Class[] c1,
Class[] c2,
boolean matchOnObject)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||