Package com.calebleavell.jatui.modules
Class TextModule.Builder
java.lang.Object
com.calebleavell.jatui.modules.TUIModule.Builder<TextModule.Builder>
com.calebleavell.jatui.modules.TextModule.Builder
- All Implemented Interfaces:
DirectedGraphNode<TUIModule.Property,TUIModule.Builder<?>, TextModule.Builder>
- Enclosing class:
TextModule
Builder for
Required fields:
Optional fields (with default values):
TextInputModule.
Required fields:
name, text Optional fields (with default values):
printNewLine, outputType-
Nested Class Summary
Nested classes/interfaces inherited from interface com.calebleavell.jatui.core.DirectedGraphNode
DirectedGraphNode.PropertyUpdateFlag -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected TextModule.OutputTypeTheTextModule.OutputTypeof the text to display, which includes pure output or fetching application state.protected booleanWhether to print a new line after the text is outputted.protected StringThe text to either display directly or the input identifier fetch the input from for theApplicationModule.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 TypeMethodDescriptionAppend to the text that's already been configured for this builder.build()Builds a newTextModulebased on the configuration of this builder.protected TextModule.BuilderGets a fresh instance of this type of Builder.Get theTextModule.OutputTypethat defines the behavior of this module.booleanIfprintNewLineis true, this module prints a new line after outputting.getText()Get the text that defines how this module outputs.Set theTextModule.OutputTypethat defines the behavior of this module.printNewLine(boolean printNewLine) If true, this module prints a new line after outputting.voidshallowCopy(TextModule.Builder original) Copiestext,printNewLine, andoutputType, and delegates toTUIModule.Builder.shallowCopy(TUIModule.Builder).booleanshallowStructuralEquals(TextModule.Builder first, TextModule.Builder second) Checks equality for properties given by the builder.Set the text that defines how this module outputs.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, 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
-
Field Details
-
text
The text to either display directly or the input identifier fetch the input from for theApplicationModule. -
printNewLine
protected boolean printNewLineWhether to print a new line after the text is outputted. -
outputType
TheTextModule.OutputTypeof the text to display, which includes pure output or fetching application state.
-
-
Constructor Details
-
Builder
-
Builder
protected Builder()
-
-
Method Details
-
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<TextModule.Builder>- Returns:
- A fresh, empty instance.
-
shallowCopy
Copiestext,printNewLine, andoutputType, and delegates toTUIModule.Builder.shallowCopy(TUIModule.Builder).- Overrides:
shallowCopyin classTUIModule.Builder<TextModule.Builder>- Parameters:
original- The builder to copy from.
-
printNewLine
If true, this module prints a new line after outputting.- Parameters:
printNewLine- Whether to print a new line after outputting.- Returns:
- self
-
getPrintNewLine
public boolean getPrintNewLine()IfprintNewLineis true, this module prints a new line after outputting.- Returns:
- printNewLine
-
outputType
Set theTextModule.OutputTypethat defines the behavior of this module.- Parameters:
type- the output type of this module.- Returns:
- self
-
getOutputType
Get theTextModule.OutputTypethat defines the behavior of this module.- Returns:
- the output type of this module.
-
text
Set the text that defines how this module outputs.- Parameters:
text- What to output.- Returns:
- self.
-
append
Append to the text that's already been configured for this builder.- Parameters:
text- What to append to the existing text.- Returns:
- self
-
getText
Get the text that defines how this module outputs.- Returns:
- What to output.
-
shallowStructuralEquals
Checks equality for properties given by the builder. ForTextModule, this includestext,printNewLine, andoutputType, as well as other requirements provided byTUIModule.structuralEquals(TUIModule).- Specified by:
shallowStructuralEqualsin interfaceDirectedGraphNode<TUIModule.Property,TUIModule.Builder<?>, TextModule.Builder> - Overrides:
shallowStructuralEqualsin classTUIModule.Builder<TextModule.Builder>- Parameters:
first- The first TUIModule to comparesecond- The second TUIModule to compare- Returns:
trueiffirstandsecondare equal according to builder-provided properties
-
build
Builds a newTextModulebased on the configuration of this builder.- Specified by:
buildin classTUIModule.Builder<TextModule.Builder>- Returns:
- The new
TextModule.
-