databionics.cli
Class PropertyOptions

java.lang.Object
  extended by org.apache.commons.cli.Options
      extended by databionics.cli.PropertyOptions

public class PropertyOptions
extends org.apache.commons.cli.Options

Command line options class enhanced with default values from system properties


Field Summary
protected  java.util.Hashtable properties
          hashtable for property names
 
Constructor Summary
PropertyOptions()
          Defualt constructor
 
Method Summary
 void add(java.lang.String opt, java.lang.String longOpt, boolean hasArg, boolean isRequired, java.lang.String description)
          Adds a new option with the specified values
 void add(java.lang.String opt, java.lang.String longOpt, boolean hasArg, boolean isRequired, java.lang.String description, java.lang.String property)
          Adds a new option with the specified values
 java.lang.String getPropertyValue(java.lang.String opt)
          Get a property value for an option
 
Methods inherited from class org.apache.commons.cli.Options
addOption, addOption, addOption, addOptionGroup, getOption, getOptionGroup, getOptions, getRequiredOptions, hasOption, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

properties

protected java.util.Hashtable properties
hashtable for property names

Constructor Detail

PropertyOptions

public PropertyOptions()
Defualt constructor

Method Detail

add

public void add(java.lang.String opt,
                java.lang.String longOpt,
                boolean hasArg,
                boolean isRequired,
                java.lang.String description)
Adds a new option with the specified values

Parameters:
opt - short representation of the option
longOpt - the long representation of the option
hasArg - specifies whether the Option takes an argument or not
isRequired - specifies whether the Option is required
description - describes the function of the option
Throws:
java.lang.IllegalArgumentException - if there are any non valid Option characters in opt.

add

public void add(java.lang.String opt,
                java.lang.String longOpt,
                boolean hasArg,
                boolean isRequired,
                java.lang.String description,
                java.lang.String property)
Adds a new option with the specified values

Parameters:
opt - short representation of the option
longOpt - the long representation of the option
hasArg - specifies whether the Option takes an argument or not
isRequired - specifies whether the Option is required
description - describes the function of the option
property - the name of the property with the default value
Throws:
java.lang.IllegalArgumentException - if there are any non valid Option characters in opt.

getPropertyValue

public java.lang.String getPropertyValue(java.lang.String opt)
Get a property value for an option

Parameters:
opt - the option name
Returns:
the property value


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