Module net.sourceforge.argparse4j
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
min
andmax
are 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 boolean
contains(java.lang.Object val)
Returnstrue
iffval
is valid choice according to this object's constraint.java.lang.String
textualFormat()
Return textual representation of this choice.java.lang.String
toString()
-
-
-
Method Detail
-
contains
public boolean contains(java.lang.Object val)
Description copied from interface:ArgumentChoice
Returns
true
iffval
is valid choice according to this object's constraint.If the objects derived from
RuntimeException
are thrown because of invalid input from command line, subclass must catch these exceptions and returnfalse
.- Specified by:
contains
in interfaceArgumentChoice
- Parameters:
val
- The attribute value.- Returns:
true
orfalse
.
-
textualFormat
public java.lang.String textualFormat()
Description copied from interface:ArgumentChoice
Return textual representation of this choice.
This string will be used in help and error messages.
- Specified by:
textualFormat
in interfaceArgumentChoice
- Returns:
- The textual representation of this choice.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-