public class ClassUtil
extends java.lang.Object
| Constructor and Description |
|---|
ClassUtil() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
areParameterTypesTheSame(java.lang.Class<?>[] params,
java.lang.Class<?>[] constructorParameters) |
static int |
classId(java.lang.Class<?> clazz)
Generate an ID or use the one specified
|
static java.lang.reflect.Constructor<?> |
getConstructor(java.lang.Class<?> c,
java.lang.Class<?>... parameterTypes)
Retrieve a specific constructor in the given class
|
static java.lang.Object |
getDefaultPrimitiveValue(java.lang.Class<?> c)
Get a default object of a primitive class
|
static java.lang.reflect.Method |
getMethod(java.lang.Class<?> c,
java.lang.String methodName,
java.lang.Class<?>... parameterTypes)
Retrieve a specific method in the given class
|
static java.lang.String |
getMethodSign(java.lang.reflect.Constructor<?> c)
Get the signature of a constructor
|
static java.lang.String |
getMethodSign(java.lang.reflect.Method m)
Get the signature of a method
|
static java.lang.Class<?>[] |
getObjectTypes(java.lang.Object... objects) |
static boolean |
isAssignableFrom(java.lang.Class<?> first,
java.lang.Class<?> second)
Determines if the first class is the same or a superclass of the second
|
public static java.lang.Class<?>[] getObjectTypes(java.lang.Object... objects)
public static java.lang.reflect.Constructor<?> getConstructor(java.lang.Class<?> c,
java.lang.Class<?>... parameterTypes)
throws java.lang.NoSuchMethodException
c - The class to look inparameterTypes - Parameters of the constructor to retrievejava.lang.NoSuchMethodException - Thrown if the constructor is not foundpublic static java.lang.reflect.Method getMethod(java.lang.Class<?> c,
java.lang.String methodName,
java.lang.Class<?>... parameterTypes)
throws java.lang.NoSuchMethodException
c - The class to look inmethodName - The name of the method to retrieveparameterTypes - Parameters of the method to retrievejava.lang.NoSuchMethodException - Thrown if the method is not foundpublic static java.lang.String getMethodSign(java.lang.reflect.Method m)
m - The methodpublic static java.lang.String getMethodSign(java.lang.reflect.Constructor<?> c)
c - The constructorpublic static boolean isAssignableFrom(java.lang.Class<?> first,
java.lang.Class<?> second)
first - First classsecond - Second classpublic static boolean areParameterTypesTheSame(java.lang.Class<?>[] params,
java.lang.Class<?>[] constructorParameters)
public static java.lang.Object getDefaultPrimitiveValue(java.lang.Class<?> c)
c - The primitive classpublic static int classId(java.lang.Class<?> clazz)
clazz - the class we want an id of