public class Option.Instance
extends java.lang.Object
Instance
of an Option
contains values assigned
to an option. Objects of this class make sure they adhere to constraints
applied to their related Option
.Constructor and Description |
---|
Instance() |
Modifier and Type | Method and Description |
---|---|
Option.Instance |
addValue(java.lang.String argument)
Adds a value to this option instance.
|
java.lang.String |
getName() |
java.lang.String |
getValue()
Returns the value of an option if it has one, or null if none have been
set.
|
java.lang.String |
getValue(int index)
Returns the nth value of an option where n is set by
the variable
index . |
java.util.List<java.lang.String> |
getValues() |
boolean |
hasNoValues() |
public Option.Instance addValue(java.lang.String argument) throws java.lang.IllegalArgumentException
argument
- The value or values to assign to this option instancejava.lang.IllegalArgumentException
- If the value cannot be added to the option because the option
cannot take more values or because the option doesn't take
values at allpublic java.lang.String getName()
Option.getId()
public java.lang.String getValue()
null
if none was set or this
option does not take valuespublic java.lang.String getValue(int index) throws java.lang.IndexOutOfBoundsException
index
. If this option has no values, null is
returned. The first value is at index=0
index
- The number of the value to returnnull
if this option does not
take valuesjava.lang.IndexOutOfBoundsException
- If this option instance takes values but there is as many as
index
of them.public java.util.List<java.lang.String> getValues()
null
if this
option instance does not take valuespublic boolean hasNoValues()
true
if no values have been set in this option
instance. false
otherwise.