Class RangeArgumentChoice<T extends java.lang.Comparable<T>>
- java.lang.Object
-
- net.sourceforge.argparse4j.impl.choice.RangeArgumentChoice<T>
-
- Type Parameters:
T- The type to compare.
- All Implemented Interfaces:
ArgumentChoice
public class RangeArgumentChoice<T extends java.lang.Comparable<T>> extends java.lang.Object implements ArgumentChoice
Choices from given range.
The given value will be checked if it is in range [min, max], inclusive. The
minandmaxare specified in constructor arguments.
-
-
Constructor Summary
Constructors Constructor Description RangeArgumentChoice(T min, T max)Creates object using range [min,max], inclusive.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(java.lang.Object val)Returnstrueiffvalis valid choice according to this object's constraint.java.lang.StringtextualFormat()Return textual representation of this choice.java.lang.StringtoString()
-
-
-
Method Detail
-
contains
public boolean contains(java.lang.Object val)
Description copied from interface:ArgumentChoiceReturns
trueiffvalis valid choice according to this object's constraint.If the objects derived from
RuntimeExceptionare thrown because of invalid input from command line, subclass must catch these exceptions and returnfalse.- Specified by:
containsin interfaceArgumentChoice- Parameters:
val- The attribute value.- Returns:
trueorfalse.
-
textualFormat
public java.lang.String textualFormat()
Description copied from interface:ArgumentChoiceReturn textual representation of this choice.
This string will be used in help and error messages.
- Specified by:
textualFormatin interfaceArgumentChoice- Returns:
- The textual representation of this choice.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-