[Java] Class ImportNode
- org.codehaus.groovy.ast.ImportNode
- All Implemented Interfaces and Traits:
- org.objectweb.asm.Opcodes
public class ImportNode extends AnnotatedNode
Represents an import statement of a single class
Constructor Summary
Constructor and description |
---|
ImportNode
(ClassNode type, String alias) Represent an import of an entire package, i.e. import package.Classname |
ImportNode
(String packageName) Represent an import of an entire package, i.e. import package |
ImportNode
(ClassNode type) Represent a static import of a Class, i.e. import static package.Classname |
ImportNode
(ClassNode type, String fieldName, String alias) Represent a static import of a field or method, i.e. import static package.Classname.name |
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
String |
getAlias() | |
String |
getClassName() | |
String |
getFieldName() | |
String |
getPackageName() | |
String |
getText() @return the text display of this import | |
ClassNode |
getType() | |
boolean |
isStar() | |
boolean |
isStatic() | |
void |
visit(GroovyCodeVisitor visitor) |
Inherited Methods Summary
Methods inherited from class | Name |
---|---|
class AnnotatedNode | addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic |
class ASTNode | copyNodeMetaData, equals, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getNodeMetaData, getNodeMetaData, getText, hashCode, putNodeMetaData, removeNodeMetaData, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setNodeMetaData, setSourcePosition, visit |
Constructor Detail
public ImportNode(ClassNode type, String alias)
Represent an import of an entire package, i.e. import package.Classname
- Parameters:
-
type
- the referenced class -
alias
- optional alias
public ImportNode(String packageName)
Represent an import of an entire package, i.e. import package.*
- Parameters:
-
packageName
- the name of the package
public ImportNode(ClassNode type)
Represent a static import of a Class, i.e. import static package.Classname.*
- Parameters:
-
type
- the referenced class
public ImportNode(ClassNode type, String fieldName, String alias)
Represent a static import of a field or method, i.e. import static package.Classname.name
- Parameters:
-
type
- the referenced class -
fieldName
- the field name -
alias
- optional alias
Method Detail
public String getAlias()
public String getClassName()
public String getFieldName()
public String getPackageName()
public String getText()
- Returns:
- the text display of this import
public ClassNode getType()
public boolean isStar()
public boolean isStatic()
public void visit(GroovyCodeVisitor visitor)
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/2.5.14/html/gapi/org/codehaus/groovy/ast/ImportNode.html