public final class GoloModule extends GoloElement<GoloModule> implements FunctionContainer
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MODULE_INITIALIZER_FUNCTION |
static java.lang.String |
TYPE_SUBPACKAGE |
Modifier and Type | Method and Description |
---|---|
void |
accept(GoloIrVisitor visitor)
Accept the visitor.
|
GoloModule |
add(GoloElement<?> element) |
void |
addFunction(GoloFunction function)
Adds a function to this container.
|
void |
addMacroInvocation(MacroInvocation macroCall)
Adds a macro invocation to this container.
|
java.util.List<GoloElement<?>> |
children()
Returns a list of all the direct children of this node.
|
static GoloModule |
create(PackageAndClass name,
ReferenceTable references) |
java.util.Optional<MacroInvocation> |
decoratorMacro() |
GoloModule |
decoratorMacro(MacroInvocation macro) |
GoloModule |
enclosingModule()
Returns the module containing this element.
|
java.util.Collection<Augmentation> |
getAugmentations() |
java.util.List<GoloFunction> |
getFunctions() |
java.util.Set<ModuleImport> |
getImports()
Returns the module imported by this module, including the implicit ones.
|
PackageAndClass |
getPackageAndClass() |
ReferenceTable |
getReferenceTable() |
GoloElement<?> |
getSubtypeByName(java.lang.String name) |
PackageAndClass |
getTypesPackage() |
java.util.Set<java.lang.String> |
getUsedModules()
Returns the names of the modules used by this module.
|
boolean |
hasFunctions() |
boolean |
hasMacros() |
boolean |
hasMain() |
boolean |
isEmpty() |
protected void |
replaceElement(GoloElement<?> original,
GoloElement<?> newElement)
Replace a child.
|
protected GoloModule |
self() |
java.lang.String |
sourceFile() |
GoloModule |
sourceFile(java.lang.String file) |
java.lang.String |
toString() |
ancestor, ancestor, ancestorOfType, cantConvert, cantReplace, cantReplace, children, children, descendants, descendants, descendants, documentation, documentation, doesNotContain, getLocalReferenceTable, hasParent, hasPosition, inheritedMetadata, makeParentOf, metadata, metadata, next, next, next, ofAST, parent, positionInSourceCode, positionInSourceCode, previous, previous, previous, replaceInParentBy, walk
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addElement, addFunctions, getFunction, iterator
public static final java.lang.String MODULE_INITIALIZER_FUNCTION
public static final java.lang.String TYPE_SUBPACKAGE
public static GoloModule create(PackageAndClass name, ReferenceTable references)
protected GoloModule self()
self
in class GoloElement<GoloModule>
public PackageAndClass getPackageAndClass()
getPackageAndClass
in interface FunctionContainer
public PackageAndClass getTypesPackage()
public java.lang.String sourceFile()
public GoloModule sourceFile(java.lang.String file)
public ReferenceTable getReferenceTable()
public GoloModule enclosingModule()
enclosingModule
in class GoloElement<GoloModule>
public java.util.Set<ModuleImport> getImports()
public java.util.Set<java.lang.String> getUsedModules()
Since the use
macro can inject other dependencies, this list can be not complete.
The macro is not expanded.
public java.util.Collection<Augmentation> getAugmentations()
public GoloModule decoratorMacro(MacroInvocation macro)
public java.util.Optional<MacroInvocation> decoratorMacro()
public java.util.List<GoloFunction> getFunctions()
getFunctions
in interface FunctionContainer
public boolean hasFunctions()
hasFunctions
in interface FunctionContainer
public boolean hasMacros()
public boolean hasMain()
public void addFunction(GoloFunction function)
addFunction
in interface FunctionContainer
public void addMacroInvocation(MacroInvocation macroCall)
The macro is supposed to return a GoloFunction
when expanded.
addMacroInvocation
in interface FunctionContainer
public GoloElement<?> getSubtypeByName(java.lang.String name)
public GoloModule add(GoloElement<?> element)
public 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<GoloModule>
public java.util.List<GoloElement<?>> children()
children
in class GoloElement<GoloModule>
public boolean isEmpty()
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<GoloModule>
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 java.lang.String toString()
toString
in class java.lang.Object