com.puppycrawl.tools.checkstyle.checks
public class ClassResolver extends Object
Limitations: this does not handle inner classes very well.
Version: 1.0
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. |
ClassResolver
instance.
Parameters: aLoader the ClassLoader to load classes with. aPkg the name of the package the class may belong to aImports set of imports to check if the class belongs to
Parameters: aName name of the class to check
Returns: whether a specified class is loadable with safeLoad().
Parameters: aName name of the class to resolve aCurrentClass name of current class (for inner classes).
Returns: the resolved class
Throws: ClassNotFoundException if unable to resolve the class
Parameters: aName name of the class to load
Returns: the Class
for the specified class
Throws: ClassNotFoundException if an error occurs