org.granite.util
Class ClassUtil
java.lang.Object
org.granite.util.ClassUtil
public abstract class ClassUtil
- extends Object
- Author:
- Franck WOLFF
|
Method Summary |
static Class<?> |
classOfType(Type type)
|
static
|
emptyList(Class<T> type)
|
static
|
emptyMap(Class<T> keyType,
Class<U> valueType)
|
static
|
emptySet(Class<T> type)
|
static URL |
findResource(Class<?> clazz)
|
static Class<?> |
forName(String type)
|
static
|
forName(String type,
Class<T> cast)
|
static Type |
getBoundType(TypeVariable<?> typeVariable)
|
static ClassLoader |
getClassLoader(Class<?> clazz)
|
static
|
getConstructor(Class<T> type,
Class<?>[] paramTypes)
|
static Constructor<?> |
getConstructor(String type,
Class<?>[] paramTypes)
|
static Method |
getMethod(Class<?> clazz,
String signature)
|
static String |
getMethodSignature(Method method)
|
static String |
getPackageName(Class<?> clazz)
|
static PropertyDescriptor[] |
getProperties(Class<?> clazz)
|
static String |
getTypeSignature(Class<?> type)
|
static boolean |
isPrimitive(Type type)
|
static
|
newInstance(Class<?> type,
Class<T> cast)
|
static
|
newInstance(Class<T> type,
Class<?>[] argsClass,
Object[] argsValues)
|
static Object |
newInstance(String type)
|
static Object |
newInstance(String type,
Class<?>[] argsClass,
Object[] argsValues)
|
static
|
newInstance(String type,
Class<T> cast)
|
static String |
toResourceName(Class<?> clazz)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ClassUtil
public ClassUtil()
newInstance
public static Object newInstance(String type)
throws ClassNotFoundException,
InstantiationException,
IllegalAccessException
- Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException
newInstance
public static <T> T newInstance(String type,
Class<T> cast)
throws ClassNotFoundException,
InstantiationException,
IllegalAccessException
- Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException
newInstance
public static Object newInstance(String type,
Class<?>[] argsClass,
Object[] argsValues)
throws ClassNotFoundException,
InstantiationException,
IllegalAccessException
- Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException
newInstance
public static <T> T newInstance(Class<?> type,
Class<T> cast)
throws InstantiationException,
IllegalAccessException
- Throws:
InstantiationException
IllegalAccessException
newInstance
public static <T> T newInstance(Class<T> type,
Class<?>[] argsClass,
Object[] argsValues)
throws InstantiationException,
IllegalAccessException
- Throws:
InstantiationException
IllegalAccessException
forName
public static Class<?> forName(String type)
throws ClassNotFoundException
- Throws:
ClassNotFoundException
forName
public static <T> Class<T> forName(String type,
Class<T> cast)
throws ClassNotFoundException
- Throws:
ClassNotFoundException
getConstructor
public static Constructor<?> getConstructor(String type,
Class<?>[] paramTypes)
throws ClassNotFoundException,
NoSuchMethodException
- Throws:
ClassNotFoundException
NoSuchMethodException
getConstructor
public static <T> Constructor<T> getConstructor(Class<T> type,
Class<?>[] paramTypes)
throws NoSuchMethodException
- Throws:
NoSuchMethodException
emptyList
public static <T> List<T> emptyList(Class<T> type)
emptySet
public static <T> Set<T> emptySet(Class<T> type)
emptyMap
public static <T,U> Map<T,U> emptyMap(Class<T> keyType,
Class<U> valueType)
isPrimitive
public static boolean isPrimitive(Type type)
classOfType
public static Class<?> classOfType(Type type)
getBoundType
public static Type getBoundType(TypeVariable<?> typeVariable)
getPackageName
public static String getPackageName(Class<?> clazz)
getProperties
public static PropertyDescriptor[] getProperties(Class<?> clazz)
getClassLoader
public static ClassLoader getClassLoader(Class<?> clazz)
findResource
public static URL findResource(Class<?> clazz)
toResourceName
public static String toResourceName(Class<?> clazz)
getMethodSignature
public static String getMethodSignature(Method method)
getTypeSignature
public static String getTypeSignature(Class<?> type)
getMethod
public static Method getMethod(Class<?> clazz,
String signature)
throws NoSuchMethodException
- Throws:
NoSuchMethodException