org.globus.cog.gridshell.getopt.app
Class OptionImpl

java.lang.Object
  extended byorg.globus.cog.gridshell.getopt.app.StorableImpl
      extended byorg.globus.cog.gridshell.getopt.app.OptionImpl
All Implemented Interfaces:
Comparable, Option, Storable

public class OptionImpl
extends StorableImpl
implements Option

An implementation of Option


Field Summary
 
Fields inherited from interface org.globus.cog.gridshell.getopt.interfaces.Option
FALSE, TRUE
 
Constructor Summary
OptionImpl(String description, Class type, boolean isRequired, Object defaultValue, String shortOption, String longOption)
           
OptionImpl(String description, Class type, boolean isRequired, Object defaultValue, String shortOption, String longOption, boolean isFlag)
          Creates an instance of Option
OptionImpl(String description, Class type, boolean isRequired, String shortOption, String longOption)
           
OptionImpl(String description, Class type, boolean isRequired, String shortOption, String longOption, boolean isFlag)
           
OptionImpl(String description, Class type, Object defaultValue, String shortOption, String longOption)
           
OptionImpl(String description, Class type, Object defaultValue, String shortOption, String longOption, boolean isFlag)
           
OptionImpl(String description, Class type, String shortOption, String longOption)
           
OptionImpl(String description, Class type, String shortOption, String longOption, boolean isFlag)
           
 
Method Summary
 int compareTo(Object that)
           
static Option createFlag(String description, Boolean defaultValue, String shortOption, String longOption)
           
static Option createFlag(String description, String shortOption, String longOption)
           
 String getLong()
          Returns the long key associated with this option
 String getShort()
          Returns the short key associated with this option
 boolean isFlag()
          Determines if this is a flag option.
 String toString()
           
 
Methods inherited from class org.globus.cog.gridshell.getopt.app.StorableImpl
getDescription, getType, getValidators, getValue, isRequired, isSet, resetDefaultValidators, setValidator, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.globus.cog.gridshell.getopt.interfaces.Storable
getDescription, getType, getValue, isRequired, isSet, setValue
 

Constructor Detail

OptionImpl

public OptionImpl(String description,
                  Class type,
                  boolean isRequired,
                  Object defaultValue,
                  String shortOption,
                  String longOption,
                  boolean isFlag)
Creates an instance of Option

Parameters:
description - - the description
type - - the type for this option
isRequired - - is it required (defaults to true)
defaultValue - - default value (defaults to null)
shortOption - - the short key associated with this option (must be one character)
longOption - - the long key associated with this option (must be more than one character)
isFlag - - is it a flag option (defaults to false)

OptionImpl

public OptionImpl(String description,
                  Class type,
                  boolean isRequired,
                  Object defaultValue,
                  String shortOption,
                  String longOption)

OptionImpl

public OptionImpl(String description,
                  Class type,
                  boolean isRequired,
                  String shortOption,
                  String longOption,
                  boolean isFlag)

OptionImpl

public OptionImpl(String description,
                  Class type,
                  boolean isRequired,
                  String shortOption,
                  String longOption)

OptionImpl

public OptionImpl(String description,
                  Class type,
                  String shortOption,
                  String longOption)

OptionImpl

public OptionImpl(String description,
                  Class type,
                  Object defaultValue,
                  String shortOption,
                  String longOption)

OptionImpl

public OptionImpl(String description,
                  Class type,
                  String shortOption,
                  String longOption,
                  boolean isFlag)

OptionImpl

public OptionImpl(String description,
                  Class type,
                  Object defaultValue,
                  String shortOption,
                  String longOption,
                  boolean isFlag)
Method Detail

createFlag

public static Option createFlag(String description,
                                String shortOption,
                                String longOption)

createFlag

public static Option createFlag(String description,
                                Boolean defaultValue,
                                String shortOption,
                                String longOption)

getShort

public String getShort()
Description copied from interface: Option
Returns the short key associated with this option

Specified by:
getShort in interface Option
Returns:

getLong

public String getLong()
Description copied from interface: Option
Returns the long key associated with this option

Specified by:
getLong in interface Option
Returns:

compareTo

public int compareTo(Object that)
Specified by:
compareTo in interface Comparable

isFlag

public boolean isFlag()
Description copied from interface: Option
Determines if this is a flag option. If isFlag is true, then the value of it is true if the option appears, false if it doesn't. If isFlag is false, there must be a value specified at the commandline for it.

Specified by:
isFlag in interface Option
Returns:

toString

public String toString()
Overrides:
toString in class StorableImpl