public class SourceFileScope extends AbstractJavaScope
Constructor and Description |
---|
SourceFileScope(java.lang.ClassLoader classLoader) |
SourceFileScope(java.lang.ClassLoader classLoader,
java.lang.String packageImage) |
Modifier and Type | Method and Description |
---|---|
void |
addDeclaration(NameDeclaration declaration) |
void |
configureImports(java.util.List<ASTImportDeclaration> imports)
Configures the type resolution for the symbol table.
|
ClassNameDeclaration |
findClassNameDeclaration(java.lang.String name) |
protected java.util.Set<NameDeclaration> |
findVariableHere(JavaNameOccurrence occ) |
java.util.Map<ClassNameDeclaration,java.util.List<NameOccurrence>> |
getClassDeclarations()
Convenience method that casts the declarations to
ClassNameDeclaration s. |
java.util.Set<java.lang.String> |
getExplicitImports() |
java.lang.String |
getPackageName() |
java.util.Map<java.lang.String,Node> |
getQualifiedTypeNames()
Returns a set of all types defined within this source file.
|
boolean |
hasAuxclasspath()
Whether an auxclasspath has been configured or not.
|
java.lang.Class<?> |
resolveType(java.lang.String name)
Tries to resolve a class by name.
|
java.lang.String |
toString() |
checkForDuplicatedNameDeclaration, contains, glomNames
addNameOccurrence, getDeclarations, getDeclarations, getEnclosingScope, getParent, setParent
public SourceFileScope(java.lang.ClassLoader classLoader)
public SourceFileScope(java.lang.ClassLoader classLoader, java.lang.String packageImage)
public void configureImports(java.util.List<ASTImportDeclaration> imports)
imports
- the import declarationspublic java.util.Set<java.lang.String> getExplicitImports()
public boolean hasAuxclasspath()
true
if the auxclasspath is configured and types can
be resolved reliably.resolveType(String)
public java.lang.Class<?> resolveType(java.lang.String name)
name
- the name of the classnull
if no class could be foundpublic java.lang.String getPackageName()
public void addDeclaration(NameDeclaration declaration)
addDeclaration
in interface Scope
addDeclaration
in class AbstractJavaScope
java.lang.IllegalArgumentException
- if declaration is not a ClassNameDeclaration
public java.util.Map<ClassNameDeclaration,java.util.List<NameOccurrence>> getClassDeclarations()
ClassNameDeclaration
s.AbstractScope.getDeclarations()
public java.lang.String toString()
toString
in class java.lang.Object
public ClassNameDeclaration findClassNameDeclaration(java.lang.String name)
protected java.util.Set<NameDeclaration> findVariableHere(JavaNameOccurrence occ)
findVariableHere
in class AbstractJavaScope
public java.util.Map<java.lang.String,Node> getQualifiedTypeNames()
Copyright © 2002–2017 PMD. All rights reserved.