Package org.beryx.textio
Class GenericInputReader<T>
- java.lang.Object
-
- org.beryx.textio.InputReader<T,GenericInputReader<T>>
-
- org.beryx.textio.GenericInputReader<T>
-
public class GenericInputReader<T> extends InputReader<T,GenericInputReader<T>>
A reader for values of a type T, for which a parser is passed as constructor argument.
-
-
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 Modifier and Type Field Description protected java.util.function.Function<java.lang.String,InputReader.ParseResult<T>>
parser
-
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 GenericInputReader(java.util.function.Supplier<TextTerminal<?>> textTerminalSupplier, java.util.function.Function<java.lang.String,InputReader.ParseResult<T>> parser)
-
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 string-
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
-
-
-
-
Field Detail
-
parser
protected final java.util.function.Function<java.lang.String,InputReader.ParseResult<T>> parser
-
-
Constructor Detail
-
GenericInputReader
public GenericInputReader(java.util.function.Supplier<TextTerminal<?>> textTerminalSupplier, java.util.function.Function<java.lang.String,InputReader.ParseResult<T>> parser)
-
-
Method Detail
-
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,GenericInputReader<T>>
- Parameters:
s
- the input string- Returns:
- a
InputReader.ParseResult
that holds the parsed value and/or the error messages, if errors occurred.
-
-