public class ClassResolver extends Object
Limitations: this does not handle inner classes very well.
| Constructor and Description |
|---|
ClassResolver(ClassLoader loader,
String pkg,
Set<String> imports)
Creates a new
ClassResolver instance. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isLoadable(String name)
Checks if the given class name can be loaded.
|
Class<?> |
resolve(String name,
String currentClass)
Attempts to resolve the Class for a specified name.
|
public ClassResolver(ClassLoader loader, String pkg, Set<String> imports)
ClassResolver instance.loader - the ClassLoader to load classes with.pkg - the name of the package the class may belong toimports - set of imports to check if the class belongs topublic Class<?> resolve(String name, String currentClass) throws ClassNotFoundException
name - name of the class to resolvecurrentClass - name of current class (for inner classes).ClassNotFoundException - if unable to resolve the classpublic boolean isLoadable(String name)
name - name of the class to checkCopyright © 2001–2018. All rights reserved.