Package com.helixframework.console
Class Prompt.Builder
java.lang.Object
com.helixframework.console.Prompt.Builder
- Enclosing class:
- Prompt
Builder class for creating Prompt objects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a Prompt object with the specified configuration.colorMode(Terminal.ColorMode colorMode) Sets the color mode used by the prompt.defaultValue(String defaultValue) Sets the default value for the prompt.defaultValueColor(Colors defaultValueColor) Sets the color for the default value in the prompt.optional()Specifies that the input for the prompt is optional.promptColor(Colors promptColor) Sets the color for the prompt message.promptPrefix(String promptPrefix) Sets the prefix for the prompt.promptSuffix(String promptSuffix) Sets the suffix for the prompt.
-
Constructor Details
-
Builder
Creates a new instance of Builder class to build a Prompt object.- Parameters:
reader- the ConsoleReader object to read user input fromprompt- the prompt message displayed to the user
-
-
Method Details
-
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
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
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
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
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
Sets the color for the default value in the prompt.- Parameters:
defaultValueColor- The color for the default value- Returns:
- The updated Builder object
-
colorMode
Sets the color mode used by the prompt.- Parameters:
colorMode- color mode to use for prompt rendering- Returns:
- The updated Builder object
-
build
Builds a Prompt object with the specified configuration.- Returns:
- a new instance of Prompt with the configured properties
-