com.charliedog.argv
Class NumberArgument

java.lang.Object
  |
  +--com.charliedog.argv.NumberArgument
All Implemented Interfaces:
Argument

public class NumberArgument
extends java.lang.Object
implements Argument

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


Constructor Summary
NumberArgument(java.lang.String flag, java.math.BigDecimal defaultValue, java.lang.String description)
          Initialize a new Number argument with the given flag, description, and default value.
NumberArgument(java.lang.String flag, java.lang.String description)
          Initialize a new Number argument with the given flag and description but without a default value.
 
Method Summary
 java.math.BigDecimal getValue()
          Return the value of this argument, which may be null.
 int parse(java.util.List values)
          Parsing method invoked by ArgumentParser.
 void printUsage(java.io.PrintWriter out)
          Usage method invoked by ArgumentParser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NumberArgument

public NumberArgument(java.lang.String flag,
                      java.lang.String description)
Initialize a new Number argument with the given flag and description but without a default value.


NumberArgument

public NumberArgument(java.lang.String flag,
                      java.math.BigDecimal defaultValue,
                      java.lang.String description)
Initialize a new Number argument with the given flag, description, and default value.

Method Detail

getValue

public java.math.BigDecimal getValue()
Return the 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(java.util.List values)
Parsing method invoked by ArgumentParser.

Specified by:
parse in interface Argument

printUsage

public void printUsage(java.io.PrintWriter out)
Usage method invoked by ArgumentParser.

Specified by:
printUsage in interface Argument