- All Superinterfaces:
InputPrompt,Prompt
- All Known Implementing Classes:
DefaultNumberPrompt
Interface for number prompts.
A number prompt is like an input prompt but validates that the input is a valid number.
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanWhether to allow decimal numbers or only integers.default DoubleGet the default value as a number.default StringGet the error message to show for invalid numbers.default DoublegetMax()Get the maximum allowed value.default DoublegetMin()Get the minimum allowed value.default StringGet the error message to show for out-of-range numbers.Methods inherited from interface org.jline.prompt.InputPrompt
getCompleter, getDefaultValue, getLineReader, getMask, getValidatorMethods inherited from interface org.jline.prompt.Prompt
getFilter, getMessage, getName, getTransformer
-
Method Details
-
getMin
Get the minimum allowed value.- Returns:
- the minimum value, or null for no minimum
-
getMax
Get the maximum allowed value.- Returns:
- the maximum value, or null for no maximum
-
allowDecimals
default boolean allowDecimals()Whether to allow decimal numbers or only integers.- Returns:
- true to allow decimals, false for integers only
-
getDefaultNumber
Get the default value as a number.- Returns:
- the default number value, or null for no default
-
getInvalidNumberMessage
Get the error message to show for invalid numbers.- Returns:
- the error message
-
getOutOfRangeMessage
Get the error message to show for out-of-range numbers.- Returns:
- the error message
-