public class ClassUtil extends Object
| Constructor and Description |
|---|
ClassUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Class<?> |
forNameByThread(String clsName)
Returns the Class object of the specified class name, using
the current thread's context class loader.
|
static Method |
getCloseMethod(Class<?> cls,
String name,
Class<?>[] argTypes)
Gets one of the close methods -- a close method is a method
with the same name and the compatible argument type.
|
static ClassLoader |
getContextClassLoader(Class<?> reference)
Returns the context ClassLoader for the reference class.
|
static boolean |
isInstance(Object value,
Class<?> clz) |
static Object |
newInstance(Class<?> cls,
Object[] args)
Instantiates a new instance of the specified class with the
specified argument.
|
public static final Method getCloseMethod(Class<?> cls, String name, Class<?>[] argTypes) throws NoSuchMethodException
NoSuchMethodExceptionpublic static final Object newInstance(Class<?> cls, Object[] args) throws NoSuchMethodException, InstantiationException, InvocationTargetException, IllegalAccessException
public static final Class<?> forNameByThread(String clsName) throws ClassNotFoundException
ClassNotFoundExceptionpublic static ClassLoader getContextClassLoader(Class<?> reference)
Default: returns from the current thread.
Or specify the library property of org.zkoss.lang.contextClassLoader.class
in zk.xml to provide a customized class loader.
reference - the reference class where it is invoked from.Copyright © 2022. All rights reserved.