[Java] Class ImportNode
- org.codehaus.groovy.ast.ImportNode
public class ImportNode extends AnnotatedNode
Represents an import statement.
Constructor Summary
Constructor and description |
---|
ImportNode
(ClassNode type, String alias) An import of a single type, i.e. import pack.Type or import pack.Type as Alias
|
ImportNode
(String packageName) An import of all types in a package, i.e. import pack.*
|
ImportNode
(ClassNode type) An import of all static members of a type, i.e. import static pack.Type.*
|
ImportNode
(ClassNode type, String fieldName, String alias) An import of a static field or method of a type, i.e. import static pack.Type.name or import static pack.Type.name as alias
|
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
public String |
getAlias() | |
public String |
getClassName() | |
public String |
getFieldName() | |
public String |
getPackageName() | |
public String |
getText()
| |
public ClassNode |
getType() | |
public boolean |
isStar() | |
public boolean |
isStatic() | |
public void |
setType(ClassNode type) | |
public void |
visit(GroovyCodeVisitor visitor) |
Inherited Methods Summary
Methods inherited from class | Name |
---|---|
class AnnotatedNode | addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic |
class ASTNode | copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit |
Constructor Detail
public ImportNode(ClassNode type, String alias)
An import of a single type, i.e. import pack.Type
or import pack.Type as Alias
- Parameters:
-
type
- the type reference -
alias
- optional alias
public ImportNode(String packageName)
An import of all types in a package, i.e. import pack.*
- Parameters:
-
packageName
- the name of the package
public ImportNode(ClassNode type)
An import of all static members of a type, i.e. import static pack.Type.*
- Parameters:
-
type
- the type reference
public ImportNode(ClassNode type, String fieldName, String alias)
An import of a static field or method of a type, i.e. import static pack.Type.name
or import static pack.Type.name as alias
- Parameters:
-
type
- the type reference -
fieldName
- the field name -
alias
- optional alias
Method Detail
public String getAlias()
public String getClassName()
public String getFieldName()
public String getPackageName()
@Override public String getText()
- Returns:
- the text display of this import
public ClassNode getType()
public boolean isStar()
public boolean isStatic()
public void setType(ClassNode type)
@Override public void visit(GroovyCodeVisitor visitor)
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/org/codehaus/groovy/ast/ImportNode.html