Class Prompt.Builder

java.lang.Object
com.helixframework.console.Prompt.Builder
Enclosing class:
Prompt

public static class Prompt.Builder extends Object
Builder class for creating Prompt objects.
  • Constructor Details

    • Builder

      public Builder(jline.console.ConsoleReader reader, String prompt)
      Creates a new instance of Builder class to build a Prompt object.
      Parameters:
      reader - the ConsoleReader object to read user input from
      prompt - the prompt message displayed to the user
  • Method Details

    • promptPrefix

      public Prompt.Builder promptPrefix(String promptPrefix)
      Sets the prefix for the prompt.
      Parameters:
      promptPrefix - the prefix to be displayed before the prompt message
      Returns:
      the Builder object with the updated prompt prefix
    • promptSuffix

      public Prompt.Builder promptSuffix(String promptSuffix)
      Sets the suffix for the prompt.
      Parameters:
      promptSuffix - the suffix to be displayed after the prompt message
      Returns:
      the Builder object with the updated prompt suffix
    • defaultValue

      public Prompt.Builder defaultValue(String defaultValue)
      Sets the default value for the prompt.
      Parameters:
      defaultValue - the default value to be displayed in the prompt
      Returns:
      the Builder object with the updated default value
    • optional

      public Prompt.Builder optional()
      Specifies that the input for the prompt is optional. If no value is entered by the user, the prompt will return an empty String unless a default value is specified.
      Returns:
      the Builder object with the required flag set to false
    • promptColor

      public Prompt.Builder promptColor(Colors promptColor)
      Sets the color for the prompt message.
      Parameters:
      promptColor - the color for the prompt message
      Returns:
      the Builder object with the updated prompt color
    • defaultValueColor

      public Prompt.Builder defaultValueColor(Colors defaultValueColor)
      Sets the color for the default value in the prompt.
      Parameters:
      defaultValueColor - The color for the default value
      Returns:
      The updated Builder object
    • colorMode

      public Prompt.Builder colorMode(Terminal.ColorMode colorMode)
      Sets the color mode used by the prompt.
      Parameters:
      colorMode - color mode to use for prompt rendering
      Returns:
      The updated Builder object
    • build

      public Prompt build()
      Builds a Prompt object with the specified configuration.
      Returns:
      a new instance of Prompt with the configured properties