public final class ImportDeclaration extends Node implements org.walkmod.merger.Mergeable<ImportDeclaration>, SymbolDefinition
This class represents a import declaration. Imports are optional for the CompilationUnit.
ImportDeclaration
::=
"import" ( "static" )? NameExpr ( "." "*" )? ";"
| Constructor and Description |
|---|
ImportDeclaration() |
ImportDeclaration(int beginLine,
int beginColumn,
int endLine,
int endColumn,
NameExpr name,
boolean isStatic,
boolean isAsterisk) |
ImportDeclaration(NameExpr name,
boolean isStatic,
boolean isAsterisk) |
| Modifier and Type | Method and Description |
|---|---|
<R,A> R |
accept(GenericVisitor<R,A> v,
A arg)
Accept method for visitor support.
|
<A> void |
accept(VoidVisitor<A> v,
A arg)
Accept method for visitor support.
|
boolean |
addBodyReference(SymbolReference bodyReference)
Adds a symbol reference to this definition.
|
boolean |
addUsage(SymbolReference usage)
Adds a usage reference to this definition and updates the definition in
that reference.
|
ImportDeclaration |
clone() |
List<SymbolReference> |
getBodyReferences()
Returns the external references contained inside the body of this
definition.
|
List<Node> |
getChildren() |
Comparator<?> |
getIdentityComparator() |
Map<String,List<SymbolDefinition>> |
getMethodDefinitions()
Gets the available methods
|
NameExpr |
getName()
Retrieves the name of the import.
|
int |
getScopeLevel()
Returns the scope level where this definition is specified.
|
String |
getSymbolName()
Gets the symbol name
|
Map<String,SymbolDefinition> |
getTypeDefinitions()
Gets the available variables
|
List<SymbolReference> |
getUsages()
Returns the references that represent usages to that definition.
|
Map<String,SymbolDefinition> |
getVariableDefinitions()
Gets the available variables
|
boolean |
isAsterisk()
Return if the import ends with "*".
|
boolean |
isStatic()
Return if the import is static.
|
void |
merge(ImportDeclaration t1,
org.walkmod.merger.MergeEngine configuration) |
boolean |
removeChild(Node child) |
boolean |
replaceChildNode(Node oldChild,
Node newChild) |
void |
setAsterisk(boolean asterisk)
Sets if this import is asterisk.
|
void |
setBodyReferences(List<SymbolReference> bodyReferences)
Sets the external references contained inside the body of this
definition.
|
void |
setName(NameExpr name)
Sets the name this import.
|
void |
setScopeLevel(int scopeLevel)
Sets the scope level where this definition is specified.
|
void |
setStatic(boolean static_)
Sets if this import is static.
|
void |
setUsages(List<SymbolReference> usages)
Sets the references that represent usages to that definition.
|
check, clone, clone, contains, diableConstraints, enableConstraints, equals, getBeginColumn, getBeginLine, getCommonAncestor, getConstraints, getData, getEndColumn, getEndLine, getParentNode, getPrettySource, getPrettySource, hashCode, isAncestorOf, isInEqualLocation, isNewNode, isPreviousThan, remove, replaceChildNodeInList, setAsParentNodeOf, setAsParentNodeOf, setBeginColumn, setBeginLine, setConstraints, setData, setEndColumn, setEndLine, toString, updateReferencespublic ImportDeclaration()
public ImportDeclaration(NameExpr name, boolean isStatic, boolean isAsterisk)
public ImportDeclaration(int beginLine,
int beginColumn,
int endLine,
int endColumn,
NameExpr name,
boolean isStatic,
boolean isAsterisk)
public boolean removeChild(Node child)
removeChild in class Nodepublic List<Node> getChildren()
getChildren in class Nodepublic <R,A> R accept(GenericVisitor<R,A> v, A arg)
Nodepublic <A> void accept(VoidVisitor<A> v, A arg)
Nodepublic NameExpr getName()
public boolean isAsterisk()
true if the import ends with "*", false otherwisepublic boolean isStatic()
true if the import is static, false otherwisepublic void setAsterisk(boolean asterisk)
asterisk - true if this import is asteriskpublic void setName(NameExpr name)
name - the name to setpublic void setStatic(boolean static_)
static_ - true if this import is staticpublic Comparator<?> getIdentityComparator()
getIdentityComparator in interface org.walkmod.merger.IdentificableNodepublic void merge(ImportDeclaration t1, org.walkmod.merger.MergeEngine configuration)
merge in interface org.walkmod.merger.Mergeable<ImportDeclaration>public List<SymbolReference> getUsages()
SymbolDefinitiongetUsages in interface SymbolDefinitionpublic void setUsages(List<SymbolReference> usages)
SymbolDefinitionsetUsages in interface SymbolDefinitionusages - references that represent usages to that definition.public List<SymbolReference> getBodyReferences()
SymbolDefinitiongetBodyReferences in interface SymbolDefinitionpublic void setBodyReferences(List<SymbolReference> bodyReferences)
SymbolDefinitionsetBodyReferences in interface SymbolDefinitionbodyReferences - external references contained inside the body of this
definition.public int getScopeLevel()
SymbolDefinitiongetScopeLevel in interface SymbolDefinitionpublic void setScopeLevel(int scopeLevel)
SymbolDefinitionsetScopeLevel in interface SymbolDefinitionscopeLevel - the scope level where this definition is specified.public boolean addBodyReference(SymbolReference bodyReference)
SymbolDefinitionaddBodyReference in interface SymbolDefinitionbodyReference - the reference to add.public boolean addUsage(SymbolReference usage)
SymbolDefinitionaddUsage in interface SymbolDefinitionusage - reference to this definition.public boolean replaceChildNode(Node oldChild, Node newChild)
replaceChildNode in class Nodepublic ImportDeclaration clone() throws CloneNotSupportedException
clone in class NodeCloneNotSupportedExceptionpublic Map<String,SymbolDefinition> getVariableDefinitions()
ScopeAwaregetVariableDefinitions in interface ScopeAwarepublic Map<String,List<SymbolDefinition>> getMethodDefinitions()
ScopeAwaregetMethodDefinitions in interface ScopeAwarepublic Map<String,SymbolDefinition> getTypeDefinitions()
ScopeAwaregetTypeDefinitions in interface ScopeAwarepublic String getSymbolName()
SymbolDefinitiongetSymbolName in interface SymbolDefinitionCopyright © 2018. All rights reserved.