databionics.cli
Class PropertyCommandLine

java.lang.Object
  extended by databionics.cli.PropertyCommandLine

public class PropertyCommandLine
extends java.lang.Object

Command line options class enhanced with default values from system properties.


Constructor Summary
PropertyCommandLine(org.apache.commons.cli.CommandLine cmd, PropertyOptions options)
          Creates an PropertyCommandLine using the specified parameters.
 
Method Summary
 java.lang.String getOptionValue(java.lang.String opt)
           Retrieve the argument, if any, of this option.
 java.lang.String getOptionValue(java.lang.String opt, java.lang.String def)
           Retrieve the argument, if any, of this option.
 double getOptionValueAsDouble(java.lang.String opt, double def)
           Retrieve the argument as double
 int getOptionValueAsInt(java.lang.String opt, int def)
           Retrieve the argument as int
 boolean hasOption(java.lang.String opt)
           Query to see if an option has been set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyCommandLine

public PropertyCommandLine(org.apache.commons.cli.CommandLine cmd,
                           PropertyOptions options)
Creates an PropertyCommandLine using the specified parameters.

Parameters:
cmd - parsed command line
options - original property options
Method Detail

getOptionValue

public java.lang.String getOptionValue(java.lang.String opt)

Retrieve the argument, if any, of this option.

Parameters:
opt - the name of the option
Returns:
Value of the argument if option is set, and has an argument, otherwise null.

getOptionValue

public java.lang.String getOptionValue(java.lang.String opt,
                                       java.lang.String def)

Retrieve the argument, if any, of this option.

Parameters:
opt - the name of the option
def - the default value of the option
Returns:
Value of the argument if option is set, and has an argument, otherwise the default value.

getOptionValueAsInt

public int getOptionValueAsInt(java.lang.String opt,
                               int def)

Retrieve the argument as int

Parameters:
opt - the name of the option
def - the default value if parsing fails
Returns:
Value or default of the argument as int

getOptionValueAsDouble

public double getOptionValueAsDouble(java.lang.String opt,
                                     double def)

Retrieve the argument as double

Parameters:
opt - the name of the option
def - the default value if parsing fails
Returns:
Value or default of the argument as double

hasOption

public boolean hasOption(java.lang.String opt)

Query to see if an option has been set.

Parameters:
opt - Short name of the option
Returns:
true if set, false if not


Copyright © 2005-2006 Databionics Research Group. All Rights Reserved.