org.xlattice.util.cmdline
Class IntOpt

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

public class IntOpt
extends CmdLineOpt

Bind a command line argument to an int field in an object, optionally specifiying minimum and maximum value.

Author:
Jim Dixon

Field Summary
 
Fields inherited from class org.xlattice.util.cmdline.CmdLineOpt
description, fieldName, fieldRef, option
 
Constructor Summary
IntOpt(java.lang.String oName, java.lang.String fName)
           
IntOpt(java.lang.String oName, java.lang.String fName, int min, int max)
           
IntOpt(java.lang.String oName, java.lang.String fName, java.lang.String desc)
           
IntOpt(java.lang.String oName, java.lang.String fName, java.lang.String desc, int min, int max)
          Create a command line argument-int field binding.
 
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

IntOpt

public IntOpt(java.lang.String oName,
              java.lang.String fName,
              java.lang.String desc,
              int min,
              int max)
Create a command line argument-int field binding.

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

IntOpt

public IntOpt(java.lang.String oName,
              java.lang.String fName,
              int min,
              int max)

IntOpt

public IntOpt(java.lang.String oName,
              java.lang.String fName,
              java.lang.String desc)

IntOpt

public IntOpt(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