|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.pmd.lang.symboltable.AbstractScope
net.sourceforge.pmd.lang.java.symboltable.AbstractJavaScope
net.sourceforge.pmd.lang.java.symboltable.SourceFileScope
public class SourceFileScope
This scope is the outer most scope of a Java file. A Source File can contain one ore more classes.
Constructor Summary | |
---|---|
SourceFileScope()
|
|
SourceFileScope(String packageImage)
|
Method Summary | |
---|---|
void |
addDeclaration(NameDeclaration declaration)
Adds a new declaration to this scope. |
void |
configureImports(ClassLoader classLoader,
List<ASTImportDeclaration> imports)
Configures the type resolution for the symbol table. |
ClassNameDeclaration |
findClassNameDeclaration(String name)
|
protected NameDeclaration |
findVariableHere(JavaNameOccurrence occ)
|
Map<ClassNameDeclaration,List<NameOccurrence>> |
getClassDeclarations()
Convenience method that casts the declarations to ClassNameDeclaration s. |
Set<String> |
getExplicitImports()
|
String |
getPackageName()
|
Map<String,Node> |
getQualifiedTypeNames()
Returns a set of all types defined within this source file. |
boolean |
hasAuxclasspath()
Whether an auxclasspath has been configured or not. |
Class<?> |
resolveType(String name)
Tries to resolve a class by name. |
String |
toString()
|
Methods inherited from class net.sourceforge.pmd.lang.java.symboltable.AbstractJavaScope |
---|
checkForDuplicatedNameDeclaration, contains, glomNames |
Methods inherited from class net.sourceforge.pmd.lang.symboltable.AbstractScope |
---|
addNameOccurrence, getDeclarations, getDeclarations, getEnclosingScope, getParent, setParent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SourceFileScope()
public SourceFileScope(String packageImage)
Method Detail |
---|
public void configureImports(ClassLoader classLoader, List<ASTImportDeclaration> imports)
classLoader
- the class loader to use to find additional classesimports
- the import declarationspublic Set<String> getExplicitImports()
public boolean hasAuxclasspath()
true
if the auxclasspath is configured and types can be resolved reliably.resolveType(String)
public Class<?> resolveType(String name)
name
- the name of the class
null
if no class could be foundpublic String getPackageName()
public void addDeclaration(NameDeclaration declaration)
Scope.contains(NameOccurrence)
and Scope.addNameOccurrence(NameOccurrence)
can
be used correctly.
addDeclaration
in interface Scope
addDeclaration
in class AbstractJavaScope
declaration
- the declaration to add
IllegalArgumentException
- if declaration is not a ClassNameDeclaration
public Map<ClassNameDeclaration,List<NameOccurrence>> getClassDeclarations()
ClassNameDeclaration
s.
AbstractScope.getDeclarations()
public String toString()
toString
in class Object
public ClassNameDeclaration findClassNameDeclaration(String name)
protected NameDeclaration findVariableHere(JavaNameOccurrence occ)
findVariableHere
in class AbstractJavaScope
public Map<String,Node> getQualifiedTypeNames()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |