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

public static class ApplicationModule.Builder extends TUIModule.Builder<ApplicationModule.Builder>
Builder for ApplicationModule.

Required fields: name
Optional fields (with default values): inputMap, onExit
Implementation Note:
This class doesn't override TUIModule.Builder.shallowCopy(TUIModule.Builder) because inputMap is private and thus is known to not be touched before building, and onExit is added to children until building, which means it's automatically handled by the super method.
  • Constructor Details

    • Builder

      protected Builder(String name)
    • Builder

      protected Builder()
      Creates a fresh instance for copying utility.
  • Method Details

    • createInstance

      protected ApplicationModule.Builder 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:
      createInstance in class TUIModule.Builder<ApplicationModule.Builder>
      Returns:
      A fresh, empty instance.
    • home

      Sets the home of the application. The home of a ApplicationModule is 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 the application, printStream, scanner, and ansiEnabled for all children, including home. 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

      public TUIModule.Builder<?> getHome()
      Gets the home of the application. The home of a ApplicationModule is 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

      public ApplicationModule.Builder onExit(TUIModule.Builder<?> onExit)
      Sets the onExit module for the application. It will remain a child of the builder to allow for property propagation, but for a built ApplicationModule, 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

      public TUIModule.Builder<?> getOnExit()
      Gets the onExit module for the application. It will remain a child of the builder to allow for property propagation, but for a built ApplicationModule, 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

      public ApplicationModule build()
      Builds a new ApplicationModule based on this builder.

      Note: Building this application module will recursively set the application, printStream, scanner, and ansiEnabled for all children, including home. It will not update ansi. It will also not update any properties that have been locked.
      Specified by:
      build in class TUIModule.Builder<ApplicationModule.Builder>
      Returns:
      The built ApplicationModule