Package com.calebleavell.jatui.modules
Class FunctionModule.Builder
java.lang.Object
com.calebleavell.jatui.modules.TUIModule.Builder<FunctionModule.Builder>
com.calebleavell.jatui.modules.FunctionModule.Builder
- All Implemented Interfaces:
DirectedGraphNode<TUIModule.Property,TUIModule.Builder<?>, FunctionModule.Builder>
- Enclosing class:
FunctionModule
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.calebleavell.jatui.core.DirectedGraphNode
DirectedGraphNode.PropertyUpdateFlag -
Field Summary
Fields inherited from class com.calebleavell.jatui.modules.TUIModule.Builder
ansi, application, children, enableAnsi, logger, name, printStream, propertyUpdateFlags, scanner, type, usedNames -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newFunctionModulebased on this builder.protected FunctionModule.BuilderGets a fresh instance of this type of Builder.The function is theSupplierlogic that this module will execute when it is run.The function is theSupplierlogic that this module will execute when it is run.Supplier<?> The function is theSupplierlogic that this module will execute when it is run.voidshallowCopy(FunctionModule.Builder original) Creates a copy oforiginalby mutating this instance.Methods inherited from class com.calebleavell.jatui.modules.TUIModule.Builder
addChild, addChild, addChildren, addChildren, appendStyle, application, clearChildren, deepCopy, deepCopy, enableAnsi, getAnsi, getAnsiEnabled, getApplication, getChild, getChild, getChildren, getCopy, getDeepCopy, getName, getPrintStream, getPropertyUpdateFlags, getScanner, getType, lockProperty, name, prependStyle, prependToName, printStream, scanner, self, shallowStructuralEquals, structuralEquals, style, toString, unlockProperty, updateFlag, updatePropertiesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.calebleavell.jatui.core.DirectedGraphNode
abstractSelf, containsNullNode, containsNullNode, dfs, dfs, forEach, forEachChild, structuralEquals, structuralEquals, updateProperty, updateProperty
-
Constructor Details
-
Builder
Constructs a builder based on a provided name and Supplier- Parameters:
name- The unique name of the modulefunction- The Supplier that will be executed when this module is built and run.
-
Builder
Constructs a builder based on a provided name and Runnable. Note that the Runnable will get wrapped in a Supplier that returnsnull- Parameters:
name- The unique name of the modulefunction- The Runnable that will be executed when this module is built and run.
-
Builder
protected Builder()
-
-
Method Details
-
getFunction
The function is theSupplierlogic that this module will execute when it is run.- Returns:
- The function stored by this module.
-
function
The function is theSupplierlogic that this module will execute when it is run.- Parameters:
function- The Supplier to be run when this module is run- Returns:
- self
-
function
The function is theSupplierlogic that this module will execute when it is run.- Parameters:
function- The Runnable to be run when this module is run (this will be wrapped in a Supplier that returns null.)- Returns:
- self
-
createInstance
Gets a fresh instance of this type of Builder. Note, this is intended only for copying utility and may have unknown consequences if used in other ways.- Specified by:
createInstancein classTUIModule.Builder<FunctionModule.Builder>- Returns:
- A fresh, empty instance.
-
shallowCopy
Creates a copy oforiginalby mutating this instance. Children are not copied. This is a utility method forTUIModule.Builder.getCopy()- Overrides:
shallowCopyin classTUIModule.Builder<FunctionModule.Builder>- Parameters:
original- The builder to copy from
-
build
Builds a newFunctionModulebased on this builder.- Specified by:
buildin classTUIModule.Builder<FunctionModule.Builder>- Returns:
- The built
FunctionModule
-