Package com.calebleavell.jatui.modules
Class FunctionModule
java.lang.Object
com.calebleavell.jatui.modules.TUIModule
com.calebleavell.jatui.modules.FunctionModule
Handles arbitrary logic execution for the application by executing a
Supplier when the module is run.
If tied to an ApplicationModule, whatever the supplier returns is updated in the app's inputMap and can
be accessed via ApplicationModule.getInput(String).-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.calebleavell.jatui.modules.TUIModule
TUIModule.Property -
Field Summary
Fields inherited from class com.calebleavell.jatui.modules.TUIModule
DEFAULT_SCANNER, logger, restart, UNNAMED_ERROR -
Constructor Summary
ConstructorsConstructorDescriptionFunctionModule(FunctionModule.Builder builder) Builds aFunctionModulebased on the state ofbuilder -
Method Summary
Modifier and TypeMethodDescriptionstatic FunctionModule.BuilderConstructs a newFunctionModulebuilder.static FunctionModule.BuilderConstructs a newFunctionModulebuilder.voidRuns the stored function, attempts to update the application input based on what the function returned, then runs children as provided byTUIModule.start()Supplier<?> The function is theSupplierlogic that this module will execute when it is run.Methods inherited from class com.calebleavell.jatui.modules.TUIModule
getAnsi, getAnsiEnabled, getApplication, getChild, getChild, getChildren, getCurrentRunningBranch, getCurrentRunningChild, getCurrentRunningChild, getName, getPrintStream, getScanner, navigateTo, restart, restartChild, shallowStructuralEquals, start, structuralEquals, terminate, terminateChild, toString, toTreeString, toTreeString
-
Constructor Details
-
FunctionModule
Builds aFunctionModulebased on the state ofbuilder- Parameters:
builder- TheFunctionModule.Builderthat is building the module.
-
-
Method Details
-
doRunLogic
public void doRunLogic()Runs the stored function, attempts to update the application input based on what the function returned, then runs children as provided byTUIModule.start()- Specified by:
doRunLogicin classTUIModule
-
getFunction
The function is theSupplierlogic that this module will execute when it is run.- Returns:
- The function stored by this module.
-
builder
Constructs a newFunctionModulebuilder.- Parameters:
name- The name of the builder.function- The Supplier that will be executed when this module is built and run.- Returns:
- The new builder.
-
builder
Constructs a newFunctionModulebuilder.- Parameters:
name- The name of the builder.function- The Runnable that will be executed when this module is built and run.- Returns:
- The new builder.
-