|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.dyuproject.util.ClassLoaderUtil
public final class ClassLoaderUtil
ClassLoader util for loading classes and finding resources. No checked exceptions.
Constructor Summary | |
---|---|
ClassLoaderUtil()
|
Method Summary | ||
---|---|---|
static URL |
getResource(String resource,
Class<?> context)
Loads a URL resource from the classloader;
If not found, the classloader of the context class specified will be used. |
|
static URL |
getResource(String resource,
Class<?> context,
boolean checkParent)
Loads a URL resource from the classloader;
If not found, the classloader of the context class specified will be used. |
|
static Class<?> |
loadClass(String className,
Class<?> context)
Loads a class from the classloader; If not found, the classloader of the context class specified will be used. |
|
static Class<?> |
loadClass(String className,
Class<?> context,
boolean checkParent)
Loads a class from the classloader; If not found, the classloader of the context class specified will be used. |
|
static
|
newInstance(String className,
Class<?> context)
Instantiates an object using its default constructor if the className is
found in the classpath and loaded. |
|
static
|
newInstance(String className,
Class<?> context,
boolean checkParent)
Instantiates an object using its default constructor if the className is
found in the classpath and loaded. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClassLoaderUtil()
Method Detail |
---|
public static Class<?> loadClass(String className, Class<?> context)
context
class specified will be used.
public static Class<?> loadClass(String className, Class<?> context, boolean checkParent)
context
class specified will be used.
If the flag checkParent
is true, the classloader's parent is included in
the lookup.
public static <T> T newInstance(String className, Class<?> context) throws Exception
className
is
found in the classpath and loaded.
Exception
public static <T> T newInstance(String className, Class<?> context, boolean checkParent) throws Exception
className
is
found in the classpath and loaded.
Exception
public static URL getResource(String resource, Class<?> context)
URL
resource from the classloader;
If not found, the classloader of the context
class specified will be used.
public static URL getResource(String resource, Class<?> context, boolean checkParent)
URL
resource from the classloader;
If not found, the classloader of the context
class specified will be used.
If the flag checkParent
is true, the classloader's parent is included in
the lookup.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |