public class EnumInputReader<T extends Enum<T>> extends InputReader<T,EnumInputReader<T>>
InputReader.possibleValues
with the constants returned by the values() method.
It is not allowed to call withPossibleValues(List)
or withPossibleValues(Enum[])
for this reader.
By default, it uses a numbered list for displaying the possible values.InputReader.ErrorMessagesProvider, InputReader.ParseResult<T>, InputReader.ValueChecker<T>
defaultValue, equalsFunc, inputMasking, inputTrimming, numberedPossibleValues, parseErrorMessagesProvider, possibleValues, propertyName, textTerminalSupplier, valueCheckers, valueFormatter
Constructor and Description |
---|
EnumInputReader(Supplier<TextTerminal> textTerminalSupplier,
Class<T> enumClass) |
Modifier and Type | Method and Description |
---|---|
protected InputReader.ParseResult<T> |
parse(String s)
Parses the input string
|
EnumInputReader<T> |
withPossibleValues(List<T> possibleValues)
Always throws UnsupportedOperationException.
|
EnumInputReader<T> |
withPossibleValues(T... possibleValues)
Always throws UnsupportedOperationException.
|
checkConfiguration, getDefaultErrorMessage, getDefaultErrorMessages, getErrorMessages, isPossibleValue, parseAndCheck, printPrompt, read, read, withDefaultValue, withEqualsFunc, withInputMasking, withInputTrimming, withNumberedPossibleValues, withParseErrorMessagesProvider, withPropertyName, withValueChecker, withValueFormatter
public EnumInputReader(Supplier<TextTerminal> textTerminalSupplier, Class<T> enumClass)
public EnumInputReader<T> withPossibleValues(T... possibleValues)
withPossibleValues
in class InputReader<T extends Enum<T>,EnumInputReader<T extends Enum<T>>>
public EnumInputReader<T> withPossibleValues(List<T> possibleValues)
withPossibleValues
in class InputReader<T extends Enum<T>,EnumInputReader<T extends Enum<T>>>
protected InputReader.ParseResult<T> parse(String s)
InputReader
parse
in class InputReader<T extends Enum<T>,EnumInputReader<T extends Enum<T>>>
s
- the input stringInputReader.ParseResult
that holds the parsed value and/or the error messages, if errors occurred.