org.incava.jagol
Class ListOption

java.lang.Object
  extended by org.incava.jagol.Option
      extended by org.incava.jagol.ListOption

public class ListOption
extends Option

Represents a list of objects that comprise this option.


Field Summary
 
Fields inherited from class org.incava.jagol.Option
longName, shortName
 
Constructor Summary
ListOption(java.lang.String longName, java.lang.String description)
          Creates the option.
ListOption(java.lang.String longName, java.lang.String description, java.util.List value)
          Creates the option, with a default list.
 
Method Summary
protected  java.lang.Object convert(java.lang.String str)
          Returns the string, possibly converted to a different Object type.
 java.util.List getValue()
          Returns the value.
protected  void parse(java.lang.String str)
          Parses the value into the value list.
 boolean set(java.lang.String arg, java.util.List args)
          Sets from a list of command-line arguments.
 void setValue(java.util.List value)
          Sets the value.
 void setValue(java.lang.String value)
          Sets the value from the string, for a list type.
 java.lang.String toString()
           
 
Methods inherited from class org.incava.jagol.Option
getDescription, getLongName, getShortName, setLongName, setShortName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ListOption

public ListOption(java.lang.String longName,
                  java.lang.String description)
Creates the option.


ListOption

public ListOption(java.lang.String longName,
                  java.lang.String description,
                  java.util.List value)
Creates the option, with a default list.

Method Detail

getValue

public java.util.List getValue()
Returns the value. This is empty by default.


setValue

public void setValue(java.util.List value)
Sets the value.


setValue

public void setValue(java.lang.String value)
              throws InvalidTypeException
Sets the value from the string, for a list type. Assumes whitespace or comma delimiter

Specified by:
setValue in class Option
Throws:
InvalidTypeException

set

public boolean set(java.lang.String arg,
                   java.util.List args)
            throws OptionException
Sets from a list of command-line arguments. Returns whether this option could be set from the current head of the list. Assumes whitespace or comma delimiter.

Specified by:
set in class Option
Throws:
OptionException

parse

protected void parse(java.lang.String str)
              throws InvalidTypeException
Parses the value into the value list. If subclasses want to convert the string to their own data type, override the convert method.

Throws:
InvalidTypeException
See Also:
convert(String)

convert

protected java.lang.Object convert(java.lang.String str)
                            throws InvalidTypeException
Returns the string, possibly converted to a different Object type. Subclasses can convert the string to their own data type.

Throws:
InvalidTypeException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object