Package org.zkoss.zel.impl.util
Class ClassUtil
- java.lang.Object
-
- org.zkoss.zel.impl.util.ClassUtil
-
public class ClassUtil extends java.lang.ObjectClass related utilities.- Author:
- tomyeh
-
-
Constructor Summary
Constructors Constructor Description ClassUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Class<?>forNameByThread(java.lang.String clsName)Returns the Class object of the specified class name, using the current thread's context class loader.static java.lang.reflect.MethodgetCloseMethod(java.lang.Class<?> cls, java.lang.String name, java.lang.Class<?>[] argTypes)Gets one of the close methods -- a close method is a method with the same name and the compatible argument type.static java.lang.ClassLoadergetContextClassLoader(java.lang.Class<?> reference)Returns the context ClassLoader for the reference class.static booleanisInstance(java.lang.Object value, java.lang.Class<?> clz)static java.lang.ObjectnewInstance(java.lang.Class<?> cls, java.lang.Object[] args)Instantiates a new instance of the specified class with the specified argument.
-
-
-
Method Detail
-
getCloseMethod
public static final java.lang.reflect.Method getCloseMethod(java.lang.Class<?> cls, java.lang.String name, java.lang.Class<?>[] argTypes) throws java.lang.NoSuchMethodExceptionGets one of the close methods -- a close method is a method with the same name and the compatible argument type.- Throws:
java.lang.NoSuchMethodException
-
newInstance
public static final java.lang.Object newInstance(java.lang.Class<?> cls, java.lang.Object[] args) throws java.lang.NoSuchMethodException, java.lang.InstantiationException, java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessExceptionInstantiates a new instance of the specified class with the specified argument.- Throws:
java.lang.NoSuchMethodExceptionjava.lang.InstantiationExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.IllegalAccessException
-
forNameByThread
public static final java.lang.Class<?> forNameByThread(java.lang.String clsName) throws java.lang.ClassNotFoundExceptionReturns the Class object of the specified class name, using the current thread's context class loader.- Throws:
java.lang.ClassNotFoundException
-
getContextClassLoader
public static java.lang.ClassLoader getContextClassLoader(java.lang.Class<?> reference)
Returns the context ClassLoader for the reference class.Default: returns from the current thread.
Or specify the library property oforg.zkoss.lang.contextClassLoader.classin zk.xml to provide a customized class loader.- Parameters:
reference- the reference class where it is invoked from.- Since:
- 8.0.2
-
isInstance
public static boolean isInstance(java.lang.Object value, java.lang.Class<?> clz)
-
-