org.freehep.util.argv
Class StringOption

java.lang.Object
  extended by org.freehep.util.argv.StringOption
All Implemented Interfaces:
Option

public class StringOption
extends Object
implements Option

A String option for use with ArgumentParser. A String option may have a default value. If specified on the command line, a string option takes the value of the argument immediately following its flag.


Constructor Summary
StringOption(String flag, String name, String description)
          Initialize a new String argument with the given flag and description but without a default value.
StringOption(String flag, String name, String defaultValue, String description)
           
StringOption(String flag, String shortCut, String name, String defaultValue, String description)
           
StringOption(String flag, String shortCut, String name, String defaultValue, String description, boolean bailOut)
           
 
Method Summary
 String getOption()
          Must return the flag and parameters of this option.
 String getUsage()
          Must return a description of the usage of this option.
 String getValue()
          Return the string value of this argument, which may be null.
 int parse(List values)
          Parsing method invoked by ArgumentParser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringOption

public StringOption(String flag,
                    String name,
                    String description)
Initialize a new String argument with the given flag and description but without a default value.


StringOption

public StringOption(String flag,
                    String name,
                    String defaultValue,
                    String description)

StringOption

public StringOption(String flag,
                    String shortCut,
                    String name,
                    String defaultValue,
                    String description)

StringOption

public StringOption(String flag,
                    String shortCut,
                    String name,
                    String defaultValue,
                    String description,
                    boolean bailOut)
Method Detail

getValue

public String getValue()
Return the string value of this argument, which may be null. Returns the default value if the value was not set when the command line was parsed.


parse

public int parse(List values)
          throws MissingArgumentException,
                 BailOutException
Parsing method invoked by ArgumentParser.

Specified by:
parse in interface Option
Throws:
MissingArgumentException
BailOutException

getOption

public String getOption()
Description copied from interface: Option
Must return the flag and parameters of this option.

Specified by:
getOption in interface Option

getUsage

public String getUsage()
Description copied from interface: Option
Must return a description of the usage of this option.

Specified by:
getUsage in interface Option


Copyright © 2000-2007 FreeHEP. All Rights Reserved.