T
- The type to compare.public class RangeArgumentChoice<T extends Comparable<T>> extends Object implements ArgumentChoice
Choices from given range.
The given value will be checked if it is in range [min, max], inclusive. The
min
and max
are specified in constructor arguments.
Constructor and Description |
---|
RangeArgumentChoice(T min,
T max)
Creates object using range [
min , max ], inclusive. |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Object val)
Returns
true iff val is valid choice according to this
object's constraint. |
String |
textualFormat()
Return textual representation of this choice.
|
String |
toString() |
public boolean contains(Object val)
ArgumentChoice
Returns true
iff val
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 return false
.
contains
in interface ArgumentChoice
val
- The attribute value.true
or false
.public String textualFormat()
ArgumentChoice
Return textual representation of this choice.
This string will be used in help and error messages.
textualFormat
in interface ArgumentChoice
Copyright © 2012–2017. All rights reserved.