public class CollectionArgumentChoice<E> extends Object implements ArgumentChoice
Choice from given collection of values.
contains(Object)
checks given val
is contained in values
given in constructor argument.
Constructor and Description |
---|
CollectionArgumentChoice(Collection<E> values)
Initializes this object from given values.
|
CollectionArgumentChoice(E... values)
Initializes this object from given values.
|
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 CollectionArgumentChoice(E... values)
values
- Valid valuespublic CollectionArgumentChoice(Collection<E> values)
values
- Valid valuespublic 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.