public final class Augmentation extends GoloElement implements FunctionContainer
Represents all the augmentations applied to a type, i.e. functions and named augmentations
applied with the with
construct.
This represents code such
augment MyType {
function foo = |this| -> ...
}
or
augment MyType with MyAugmentation
Modifier and Type | Method and Description |
---|---|
void |
accept(GoloIrVisitor visitor)
Accept the visitor.
|
void |
addFunction(GoloFunction func) |
java.util.Set<GoloFunction> |
getFunctions() |
java.util.Set<java.lang.String> |
getNames() |
PackageAndClass |
getTarget() |
boolean |
hasFunctions() |
boolean |
hasLocalTarget() |
boolean |
hasNames() |
void |
merge(Augmentation other) |
Augmentation |
ofAST(GoloASTNode node) |
protected void |
replaceElement(GoloElement original,
GoloElement newElement)
Replace a child.
|
void |
setTargetPackage(java.lang.String packageName) |
java.lang.String |
toString() |
void |
walk(GoloIrVisitor visitor)
Walk the visitor through this node children.
|
Augmentation |
with(java.util.Collection<?> objects) |
Augmentation |
with(java.lang.Object... objects) |
cantConvert, cantReplace, cantReplace, doesNotContain, getASTNode, getDocumentation, getLocalReferenceTable, getParentNode, getPositionInSourceCode, hasASTNode, makeParentOf, replaceInParentBy, setASTNode, setParentNode
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addFunctions
public Augmentation ofAST(GoloASTNode node)
ofAST
in class GoloElement
public PackageAndClass getTarget()
public boolean hasLocalTarget()
public void setTargetPackage(java.lang.String packageName)
public java.util.Set<GoloFunction> getFunctions()
getFunctions
in interface FunctionContainer
public void addFunction(GoloFunction func)
addFunction
in interface FunctionContainer
public boolean hasFunctions()
hasFunctions
in interface FunctionContainer
public java.util.Set<java.lang.String> getNames()
public boolean hasNames()
public Augmentation with(java.lang.Object... objects)
public Augmentation with(java.util.Collection<?> objects)
public void merge(Augmentation other)
public java.lang.String toString()
toString
in class java.lang.Object
protected void replaceElement(GoloElement original, GoloElement newElement)
GoloElement
Replace original
with newElement
if original
is a child of this node
and type matches.
replaceElement
in class GoloElement
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)
public void accept(GoloIrVisitor visitor)
GoloElement
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
public void walk(GoloIrVisitor visitor)
GoloElement
walk
in class GoloElement