public class StringInputReader extends InputReader<String,StringInputReader>
InputReader.ErrorMessageProvider, InputReader.ParseResult<T>
defaultValue, errorMessageProvider, inputMasking, inputTrimming, numberedPossibleValues, possibleValues, propertyName, textTerminalSupplier, valueFormatter
Constructor and Description |
---|
StringInputReader(Supplier<TextTerminal> textTerminalSupplier) |
Modifier and Type | Method and Description |
---|---|
void |
checkConfiguration()
Checks if the reader is correctly configured.
|
protected List<String> |
getDefaultErrorMessage(String s)
If no errorMessageProvider exists, this method is used to provide the list of error messages for the input string s.
|
InputReader.ParseResult<String> |
parse(String s)
Parses the input string
|
StringInputReader |
withMaxLength(int maxLength) |
StringInputReader |
withMinLength(int minLength) |
StringInputReader |
withPattern(String regex) |
StringInputReader |
withPattern(String regex,
int flags) |
getDefaultErrorMessage, getErrorMessage, printPrompt, read, read, withDefaultValue, withErrorMessageProvider, withInputMasking, withInputTrimming, withNumberedPossibleValues, withPossibleValues, withPossibleValues, withPropertyName, withValueFormatter
public StringInputReader(Supplier<TextTerminal> textTerminalSupplier)
public StringInputReader withPattern(String regex)
public StringInputReader withPattern(String regex, int flags)
public StringInputReader withMinLength(int minLength)
public StringInputReader withMaxLength(int maxLength)
protected List<String> getDefaultErrorMessage(String s)
InputReader
getDefaultErrorMessage
in class InputReader<String,StringInputReader>
public void checkConfiguration() throws IllegalArgumentException
InputReader
checkConfiguration
in class InputReader<String,StringInputReader>
IllegalArgumentException
public InputReader.ParseResult<String> parse(String s)
InputReader
parse
in class InputReader<String,StringInputReader>
s
- the input stringInputReader.ParseResult
that holds the parsed value and/or the error messages, if errors occurred.