|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.spicefactory.cinnamon.reflect.util.ClassUtil
public class ClassUtil
Static utility methods for loading classes and reflectively creating new instances.
| Constructor Summary | |
|---|---|
ClassUtil()
|
|
| Method Summary | ||
|---|---|---|
static Class<?> |
loadClass(String className)
Loads the given Class using the context ClassLoader of the current thread. |
|
static Class<?> |
loadClass(String className,
boolean allowPrimitive,
boolean allowArray)
Loads the given Class using the context ClassLoader of the current thread. |
|
static
|
loadClass(String className,
Class<T> requiredType)
Loads the given Class if it is of the specified required type. |
|
static
|
newInstance(Class<T> type)
Creates a new instance of the given Class. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ClassUtil()
| Method Detail |
|---|
public static Class<?> loadClass(String className,
boolean allowPrimitive,
boolean allowArray)
throws ClassLoadingException
ClassLoader.loadClass method.
If the allowArray parameter is true this method allows to load Class instances that
represent arrays if the className parameter ends with brackets like in java.lang.String[].
className - the name of the class to loadallowPrimitive - whether primitive types should also be considered when resolving the given nameallowArray - whether Class instances representing array should be loaded when the className
is appended with []
ClassLoadingException - if the Class cannot be loaded
public static Class<?> loadClass(String className)
throws ClassLoadingException
className - the name of the class to load
ClassLoadingException - if the Class cannot be loaded
public static <T> Class<? extends T> loadClass(String className,
Class<T> requiredType)
throws ClassLoadingException
className - the name of the class to loadrequiredType - the Class that the loaded Class must implement or extend
ClassLoadingException - if the Class cannot be loaded or does not implement or extend the required type
public static <T> T newInstance(Class<T> type)
throws ObjectInstantiationException
type - the Class an instance should be created of
ObjectInstantiationException - if the instance cannot be created or the Constructor threw an Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||