org.incava.jagol

Class 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(String longName, String description)
Creates the option.
ListOption(String longName, String description, List value)
Creates the option, with a default list.

Method Summary

protected Object
convert(String str)
Returns the string, possibly converted to a different Object type.
List
getValue()
Returns the value.
protected void
parse(String str)
Parses the value into the value list.
boolean
set(String arg, List args)
Sets from a list of command-line arguments.
void
setValue(List value)
Sets the value.
void
setValue(String value)
Sets the value from the string, for a list type.
String
toString()

Methods inherited from class org.incava.jagol.Option

getDescription, getLongName, getShortName, set, setLongName, setShortName, setValue

Constructor Details

ListOption

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

ListOption

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

Method Details

convert

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

getValue

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

parse

protected void parse(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.

set

public boolean set(String arg,
                   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.
Overrides:
set in interface Option

setValue

public void setValue(List value)
Sets the value.

setValue

public void setValue(String value)
            throws InvalidTypeException
Sets the value from the string, for a list type. Assumes whitespace or comma delimiter
Overrides:
setValue in interface Option

toString

public String toString()