Package com.calebleavell.jatui.modules
Class ApplicationModule.Builder
java.lang.Object
com.calebleavell.jatui.modules.TUIModule.Builder<ApplicationModule.Builder>
com.calebleavell.jatui.modules.ApplicationModule.Builder
- All Implemented Interfaces:
DirectedGraphNode<TUIModule.Property,TUIModule.Builder<?>, ApplicationModule.Builder>
- Enclosing class:
ApplicationModule
Builder for
Required fields:
Optional fields (with default values):
ApplicationModule.
Required fields:
name Optional fields (with default values):
inputMap, onExit- Implementation Note:
- This class doesn't override
TUIModule.Builder.shallowCopy(TUIModule.Builder)becauseinputMapis private and thus is known to not be touched before building, andonExitis added to children until building, which means it's automatically handled by the super method.
-
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 newApplicationModulebased on this builder.protected ApplicationModule.BuilderGets a fresh instance of this type of Builder.getHome()Gets the home of the application.Gets theonExitmodule for the application.home(TUIModule.Builder<?> home) Sets the home of the application.onExit(TUIModule.Builder<?> onExit) Sets theonExitmodule for the application.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, shallowCopy, 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
-
Builder
protected Builder()Creates a fresh instance for copying utility.
-
-
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<ApplicationModule.Builder>- Returns:
- A fresh, empty instance.
-
home
Sets the home of the application. The home of aApplicationModuleis simply it's first child. This means it will be the first module to run when this application is run.
Note: When this application module is built, it will recursively set theapplication,printStream,scanner, andansiEnabledfor all children, includinghome. It will not update ansi. It will also not update any properties that have been locked.- Parameters:
home- The first module to run when this application is run.
-
getHome
Gets the home of the application. The home of aApplicationModuleis simply it's first child. This means it will be the first module to run when this application is run.- Returns:
- The home of this application module.
-
onExit
Sets theonExitmodule for the application. It will remain a child of the builder to allow for property propagation, but for a builtApplicationModule, it is a distinct module that runs after all children have finished running.- Parameters:
onExit- The module that runs at the end of this application module's run.
-
getOnExit
Gets theonExitmodule for the application. It will remain a child of the builder to allow for property propagation, but for a builtApplicationModule, it is a distinct module that runs after all children have finished running.- Returns:
- The module that runs at the end of this application module's run.
-
build
Builds a newApplicationModulebased on this builder.
Note: Building this application module will recursively set theapplication,printStream,scanner, andansiEnabledfor all children, includinghome. It will not update ansi. It will also not update any properties that have been locked.- Specified by:
buildin classTUIModule.Builder<ApplicationModule.Builder>- Returns:
- The built ApplicationModule
-