Class InputHandler

All Implemented Interfaces:
DirectedGraphNode<TUIModule.Property,TUIModule.Builder<?>,InputHandler>

public class InputHandler extends ModuleTemplate<InputHandler>
Handles management of the application state by running logic on saved inputs from the application.

Example Usage:

       InputHandler handler = InputHandler.builder("handler-name", "input_identifier")
                     .setHandler("return_value_identifier",
                             // run main logic on input
                             s -> {
                         if(!s.equals("valid_input")) throw new RuntimeException("invalid input!!");
                         else return 10;
                     },
                             // handle the RuntimeException thrown above (optional)
                             s -> {
                         app.restart();
                     })
 
Note: You will likely want to use the wrapper methods provided by TextInputModule.Builder (e.g, TextInputModule.Builder.addSafeHandler(String, Function, String)) if interfacing with user input. This class should be used if more fine-grained control is required, or if implementing a custom ModuleTemplate that works closely with application state.