public interface ClassResolver
Has same effect as calling Class.forName(String), but uses the
appropriate ClassLoader.
| Modifier and Type | Interface and Description |
|---|---|
static class |
ClassResolver.AbstractClassResolver
Partial implementation of
ClassResolver. |
static class |
ClassResolver.ThreadContextClassResolver
Implementation of
ClassResolver that calls
Thread.getContextClassLoader() on the current thread. |
| Modifier and Type | Field and Description |
|---|---|
static ClassResolver |
INSTANCE
Default resolver.
|
| Modifier and Type | Method and Description |
|---|---|
<T> Class<T> |
forName(String className,
boolean initialize)
Equivalent of
Class.forName(String, boolean, ClassLoader). |
Iterable<URL> |
getResources(String lookupName)
Equivalent of
ClassLoader.getResources(String). |
<T> T |
instantiateSafe(String className,
Object... args)
Instantiates a class and constructs an instance using the given
arguments.
|
static final ClassResolver INSTANCE
<T> Class<T> forName(String className, boolean initialize) throws ClassNotFoundException
Class.forName(String, boolean, ClassLoader).ClassNotFoundException<T> T instantiateSafe(String className, Object... args)
T - Desired typeclassName - Class nameargs - ArgumentsClassCastException - if resulting object is not an instance of TIterable<URL> getResources(String lookupName) throws IOException
ClassLoader.getResources(String).IOExceptionCopyright © 2018 Hitachi Vantara. All rights reserved.