Class CollectionArgumentChoice<E>
- java.lang.Object
-
- net.sourceforge.argparse4j.impl.choice.CollectionArgumentChoice<E>
-
- All Implemented Interfaces:
ArgumentChoice
public class CollectionArgumentChoice<E> extends java.lang.Object implements ArgumentChoice
Choice from given collection of values.
contains(Object)checks givenvalis contained in values given in constructor argument.
-
-
Constructor Summary
Constructors Constructor Description CollectionArgumentChoice(E... values)Initializes this object from given values.CollectionArgumentChoice(java.util.Collection<E> values)Initializes this object from given values.
-
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()
-
-
-
Constructor Detail
-
CollectionArgumentChoice
public CollectionArgumentChoice(E... values)
Initializes this object from given values.- Parameters:
values- Valid values
-
CollectionArgumentChoice
public CollectionArgumentChoice(java.util.Collection<E> values)
Initializes this object from given values.- Parameters:
values- Valid values
-
-
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
-
-