org.apache.fulcrum.yaafi.cli
Class Getopt

java.lang.Object
  extended by org.apache.fulcrum.yaafi.cli.Getopt

public class Getopt
extends java.lang.Object

Extremly simply command line parsing class.


Constructor Summary
Getopt(java.lang.String[] args)
          Constructor
Getopt(java.lang.String[] args, java.lang.String prefix)
          Constructor.
 
Method Summary
 boolean contains(java.lang.String option)
           
 boolean getBooleanValue(java.lang.String option)
          Returns the boolean value for the given option.
 boolean getBooleanValue(java.lang.String option, boolean defaultValue)
          Returns the boolean value for the given option.
 java.lang.String getStringValue(java.lang.String option)
          Returns the string value for the given option.
 java.lang.String getStringValue(java.lang.String option, java.lang.String defaultValue)
          Returns the string value for the given option.
 int length()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Getopt

public Getopt(java.lang.String[] args)
Constructor

Parameters:
args - the command line parameters

Getopt

public Getopt(java.lang.String[] args,
              java.lang.String prefix)
Constructor.

Parameters:
args - the command line parameters
prefix - the prefix for command line paramters
Method Detail

contains

public boolean contains(java.lang.String option)
Parameters:
option - the option we are looking for
Returns:
is the given option contained in the command line arguments?

length

public int length()
Returns:
the number of command line arguments

getStringValue

public java.lang.String getStringValue(java.lang.String option)
Returns the string value for the given option.

Parameters:
option - the option
Returns:
the associated value

getStringValue

public java.lang.String getStringValue(java.lang.String option,
                                       java.lang.String defaultValue)
Returns the string value for the given option.

Parameters:
option - the option
defaultValue - the default value if the option is not defined
Returns:
the associated value

getBooleanValue

public boolean getBooleanValue(java.lang.String option)
Returns the boolean value for the given option.

Parameters:
option - the option
Returns:
the associated value

getBooleanValue

public boolean getBooleanValue(java.lang.String option,
                               boolean defaultValue)
Returns the boolean value for the given option.

Parameters:
option - the option
defaultValue - the default value if the option is not defined
Returns:
the associated value


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.