public abstract static class ClassResolver.AbstractClassResolver extends Object implements ClassResolver
ClassResolver
. Derived class just
needs to implement getClassLoader()
.ClassResolver.AbstractClassResolver, ClassResolver.ThreadContextClassResolver
INSTANCE
Constructor and Description |
---|
AbstractClassResolver() |
Modifier and Type | Method and Description |
---|---|
<T> Class<T> |
forName(String className,
boolean initialize)
Equivalent of
Class.forName(String, boolean, ClassLoader) . |
protected abstract ClassLoader |
getClassLoader()
Returns the class loader to use for the current operation.
|
protected ClassLoader |
getClassLoaderNotNull()
Returns the class loader to use for the current operation, never
null.
|
Iterable<URL> |
getResources(String name)
Equivalent of
ClassLoader.getResources(String) . |
<T> T |
instantiateSafe(String className,
Object... args)
Instantiates a class and constructs an instance using the given
arguments.
|
public <T> T instantiateSafe(String className, Object... args)
ClassResolver
instantiateSafe
in interface ClassResolver
T
- Desired typeclassName
- Class nameargs
- Argumentspublic <T> Class<T> forName(String className, boolean initialize) throws ClassNotFoundException
ClassResolver
Class.forName(String, boolean, ClassLoader)
.forName
in interface ClassResolver
ClassNotFoundException
protected abstract ClassLoader getClassLoader()
protected ClassLoader getClassLoaderNotNull()
public Iterable<URL> getResources(String name) throws IOException
ClassResolver
ClassLoader.getResources(String)
.getResources
in interface ClassResolver
IOException
Copyright © 2020 Hitachi Vantara. All rights reserved.