|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.puppycrawl.tools.checkstyle.checks.ClassResolver
Utility class to resolve a class name to an actual class. Note that loaded classes are not initialized.
Limitations: this does not handle inner classes very well.
Constructor Summary | |
ClassResolver(ClassLoader aLoader,
String aPkg,
Set aImports)
Creates a new ClassResolver instance. |
Method Summary | |
boolean |
isLoadable(String aName)
|
Class |
resolve(String aName,
String aCurrentClass)
Attempts to resolve the Class for a specified name. |
Class |
safeLoad(String aName)
Will load a specified class is such a way that it will NOT be initialised. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ClassResolver(ClassLoader aLoader, String aPkg, Set aImports)
ClassResolver
instance.
aLoader
- the ClassLoader to load classes with.aPkg
- the name of the package the class may belong toaImports
- set of imports to check if the class belongs toMethod Detail |
public Class resolve(String aName, String aCurrentClass) throws ClassNotFoundException
aName
- name of the class to resolveaCurrentClass
- name of current class (for inner classes).
ClassNotFoundException
- if unable to resolve the classpublic boolean isLoadable(String aName)
aName
- name of the class to check
public Class safeLoad(String aName) throws ClassNotFoundException
aName
- name of the class to load
Class
for the specified class
ClassNotFoundException
- if an error occurs
|
Back to the Checkstyle Home Page | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |