org.xlattice.util.cmdline
Class LongOpt

java.lang.Object
  extended by org.xlattice.util.cmdline.CmdLineOpt
      extended by org.xlattice.util.cmdline.LongOpt

public class LongOpt
extends CmdLineOpt

Binding between a command line option and a long field in an object, with optional minimum and maximum values.


Field Summary
 
Fields inherited from class org.xlattice.util.cmdline.CmdLineOpt
description, fieldName, fieldRef, option
 
Constructor Summary
LongOpt(java.lang.String oName, java.lang.String fName)
           
LongOpt(java.lang.String oName, java.lang.String fName, long min, long max)
           
LongOpt(java.lang.String oName, java.lang.String fName, java.lang.String desc)
          Constructor defaulting option values to MIN_VALUE and MAX_VALUE.
LongOpt(java.lang.String oName, java.lang.String fName, java.lang.String desc, long min, long max)
          Create command line option and long field binding, optionally specifying a minimum and maximum option value.
 
Method Summary
protected  void bindField(java.lang.Class clazz)
          Bind parameter to target class field.
 java.lang.String optionForHelp()
          Overridden if something more elaborate than '-h' is needed.
protected  void setValue(Bindery bnd)
          Set the value in the object field bound to this option.
 
Methods inherited from class org.xlattice.util.cmdline.CmdLineOpt
getDescription, getFieldName, getOptionName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LongOpt

public LongOpt(java.lang.String oName,
               java.lang.String fName,
               java.lang.String desc,
               long min,
               long max)
Create command line option and long field binding, optionally specifying a minimum and maximum option value.

Parameters:
oName - command line option name
fName - field name
desc - description for use in help messages
min - minimum permissible value
max - maximum permissible value for option

LongOpt

public LongOpt(java.lang.String oName,
               java.lang.String fName,
               long min,
               long max)

LongOpt

public LongOpt(java.lang.String oName,
               java.lang.String fName,
               java.lang.String desc)
Constructor defaulting option values to MIN_VALUE and MAX_VALUE.


LongOpt

public LongOpt(java.lang.String oName,
               java.lang.String fName)
Method Detail

optionForHelp

public java.lang.String optionForHelp()
Description copied from class: CmdLineOpt
Overridden if something more elaborate than '-h' is needed.

Overrides:
optionForHelp in class CmdLineOpt
Returns:
option as seen in help messages

bindField

protected void bindField(java.lang.Class clazz)
Description copied from class: CmdLineOpt
Bind parameter to target class field. Must be invoked by subclasses.

Overrides:
bindField in class CmdLineOpt
Parameters:
clazz - target class for saving parameter values

setValue

protected void setValue(Bindery bnd)
Description copied from class: CmdLineOpt
Set the value in the object field bound to this option. Needs to be implemented for each primitive type accepted on the command line.

Specified by:
setValue in class CmdLineOpt
Parameters:
bnd - command line option bindery invoking setValue