public abstract class ComparableInputReader<T extends java.lang.Comparable<T>,B extends ComparableInputReader<T,B>> extends InputReader<T,B>
Comparable
.
Allows configuring the minimum and maximum permitted values.InputReader.ErrorMessagesProvider, InputReader.ParseResult<T>, InputReader.ValueChecker<T>
Modifier and Type | Field and Description |
---|---|
protected T |
maxVal |
protected T |
minVal |
defaultValue, equalsFunc, inlinePossibleValues, inputMasking, inputTrimming, itemName, numberedPossibleValues, parseErrorMessagesProvider, possibleValues, promptAdjustments, propertiesConfigurator, textTerminalSupplier, valueCheckers, valueFormatter, valueListCheckers
Constructor and Description |
---|
ComparableInputReader(java.util.function.Supplier<TextTerminal<?>> textTerminalSupplier) |
Modifier and Type | Method and Description |
---|---|
void |
checkConfiguration()
In addition to the checks performed by
InputReader.checkConfiguration() , it checks if minVal <= maxVal |
protected java.util.List<java.lang.String> |
getMinMaxErrorMessage(T val) |
boolean |
isInRange(T val)
Returns true if minVal <= val <= maxVal
|
protected abstract java.lang.String |
typeNameWithIndefiniteArticle() |
B |
withMaxVal(T maxVal)
Configures the maximum allowed value
|
B |
withMinVal(T minVal)
Configures the minimum allowed value
|
executeWithTerminal, getDefaultErrorMessage, getDefaultErrorMessages, getErrorMessages, getPossibleValue, isPossibleValue, isValueListMode, noDuplicatesChecker, nonEmptyListChecker, parse, parseAndCheck, printPrompt, read, read, readList, readList, readWithPrompt, withDefaultValue, withEqualsFunc, withInlinePossibleValues, withInlinePossibleValues, withInputMasking, withInputTrimming, withItemName, withNumberedPossibleValues, withNumberedPossibleValues, withParseErrorMessagesProvider, withPossibleValues, withPossibleValues, withPromptAdjustments, withPropertiesConfigurator, withValueChecker, withValueFormatter, withValueListChecker
public ComparableInputReader(java.util.function.Supplier<TextTerminal<?>> textTerminalSupplier)
protected abstract java.lang.String typeNameWithIndefiniteArticle()
protected java.util.List<java.lang.String> getMinMaxErrorMessage(T val)
public void checkConfiguration() throws java.lang.IllegalArgumentException
InputReader.checkConfiguration()
, it checks if minVal <= maxValcheckConfiguration
in class InputReader<T extends java.lang.Comparable<T>,B extends ComparableInputReader<T,B>>
java.lang.IllegalArgumentException
public boolean isInRange(T val)