Package org.beryx.textio
Class EnumInputReader<T extends java.lang.Enum<T>>
- java.lang.Object
-
- org.beryx.textio.InputReader<T,EnumInputReader<T>>
-
- org.beryx.textio.EnumInputReader<T>
-
public class EnumInputReader<T extends java.lang.Enum<T>> extends InputReader<T,EnumInputReader<T>>
A reader for enum values. It initializesInputReader.possibleValues
with the constants returned by thevalues()
method. By default, it uses a numbered list for displaying the possible values.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.beryx.textio.InputReader
InputReader.ErrorMessagesProvider, InputReader.InvalidIndexErrorMessagesProvider, InputReader.ParseResult<T>, InputReader.ValueChecker<T>
-
-
Field Summary
-
Fields inherited from class org.beryx.textio.InputReader
defaultValue, equalsFunc, inlinePossibleValues, inputMasking, inputTrimming, invalidIndexErrorMessagesProvider, itemName, numberedPossibleValues, parseErrorMessagesProvider, possibleValues, promptAdjustments, propertiesConfigurator, PROPS_PREFIX_ERROR_MESSAGE, textTerminalSupplier, valueCheckers, valueFormatter, valueListCheckers
-
-
Constructor Summary
Constructors Constructor Description EnumInputReader(java.util.function.Supplier<TextTerminal<?>> textTerminalSupplier, java.lang.Class<T> enumClass)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected InputReader.ParseResult<T>
parse(java.lang.String s)
Parses the input stringEnumInputReader<T>
withAllValues()
EnumInputReader<T>
withAllValuesInline()
EnumInputReader<T>
withAllValuesNumbered()
-
Methods inherited from class org.beryx.textio.InputReader
checkConfiguration, executeWithTerminal, getDefaultErrorMessage, getDefaultErrorMessages, getErrorMessages, getPossibleValue, isPossibleValue, isValueListMode, noDuplicatesChecker, nonEmptyListChecker, parseAndCheck, printPrompt, read, read, readList, readList, readWithPrompt, withDefaultValue, withEqualsFunc, withInlinePossibleValues, withInlinePossibleValues, withInputMasking, withInputTrimming, withInvalidIndexErrorMessagesProvider, withItemName, withNumberedPossibleValues, withNumberedPossibleValues, withParseErrorMessagesProvider, withPossibleValues, withPossibleValues, withPromptAdjustments, withPropertiesConfigurator, withPropertiesPrefix, withValueChecker, withValueFormatter, withValueListChecker
-
-
-
-
Constructor Detail
-
EnumInputReader
public EnumInputReader(java.util.function.Supplier<TextTerminal<?>> textTerminalSupplier, java.lang.Class<T> enumClass)
-
-
Method Detail
-
withAllValues
public EnumInputReader<T> withAllValues()
-
withAllValuesNumbered
public EnumInputReader<T> withAllValuesNumbered()
-
withAllValuesInline
public EnumInputReader<T> withAllValuesInline()
-
parse
protected InputReader.ParseResult<T> parse(java.lang.String s)
Description copied from class:InputReader
Parses the input string- Specified by:
parse
in classInputReader<T extends java.lang.Enum<T>,EnumInputReader<T extends java.lang.Enum<T>>>
- Parameters:
s
- the input string- Returns:
- a
InputReader.ParseResult
that holds the parsed value and/or the error messages, if errors occurred.
-
-