public final class ModuleImport extends GoloElement<ModuleImport> implements ToplevelGoloElement
Represents golo code such as
import java.util.Collections
| Modifier and Type | Method and Description |
|---|---|
void |
accept(GoloIrVisitor visitor)
Accept the visitor.
|
boolean |
equals(java.lang.Object o) |
PackageAndClass |
getPackageAndClass()
Returns the
PackageAndClass of the module to be imported. |
int |
hashCode() |
static ModuleImport |
implicit(java.lang.Object name)
Create an implicit module import.
|
boolean |
isImplicit()
Checks if this import is implicit.
|
static ModuleImport |
of(java.lang.Object name)
Create a module import.
|
protected void |
replaceElement(GoloElement<?> original,
GoloElement<?> newElement)
Replace a child.
|
protected ModuleImport |
self() |
java.lang.String |
toString() |
ancestor, ancestor, ancestorOfType, cantConvert, cantReplace, cantReplace, children, children, children, descendants, descendants, descendants, documentation, documentation, doesNotContain, enclosingModule, getLocalReferenceTable, hasParent, hasPosition, inheritedMetadata, makeParentOf, metadata, metadata, next, next, next, ofAST, parent, positionInSourceCode, positionInSourceCode, previous, previous, previous, replaceInParentBy, walkpublic static ModuleImport implicit(java.lang.Object name)
Implicit imports are ones automatically added to a module, contrary to ones added by the developer.
If the given name is already a module import, it is returned unchanged if already implicit; a new one is created
otherwise.
The name to import is derived using PackageAndClass.of(Object).
public static ModuleImport of(java.lang.Object name)
If the given name is already a module import, it is returned unchanged.
The name to import is derived using PackageAndClass.of(Object).
protected ModuleImport self()
self in class GoloElement<ModuleImport>public PackageAndClass getPackageAndClass()
PackageAndClass of the module to be imported.public boolean isImplicit()
Implicit imports are ones automatically added to a module, contrary to ones added by the developer.
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
Equality ignores the implicit status. Therefore, adding explicitly a import that is already implicit is a noop.
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic void accept(GoloIrVisitor visitor)
This method should only call the visitor visitXXXX method.
The children of this node will be visited by the
GoloElement.walk(GoloIrVisitor) method.
accept in class GoloElement<ModuleImport>protected void replaceElement(GoloElement<?> original, GoloElement<?> newElement)
Replace original with newElement if original is a child of this node
and type matches.
replaceElement in class GoloElement<ModuleImport>original - the original value to replace. Must be a child of this nodenewElement - the element to replace with. Type must match.GoloElement.cantReplace(),
GoloElement.cantReplace(GoloElement, GoloElement),
GoloElement.doesNotContain(GoloElement),
GoloElement.cantConvert(String, Object)