Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.enhydra.xml.xmlc.commands.options
Class Option  view Option download Option.java

java.lang.Object
  extended byorg.enhydra.xml.xmlc.commands.options.Option
Direct Known Subclasses:
BooleanOption, FlagOption

public abstract class Option
extends java.lang.Object

Definition of an option. The general or specific options are classes derived from this class. A general class is parameterizes at instantiation and is able to create parse multiple options. A specific class only parses one option. The Option classes should be immutable; a generic client data object is pass to the parse methods to recieve the configuration.


Field Summary
protected  java.lang.String help
          Help message for the option.
protected  boolean multipleAllowed
          Are multiple instances of the option allowed?
protected  java.lang.String name
          The option name, including the leading `-'.
protected  int numArgs
          The number of arguments for the option.
 
Constructor Summary
Option(java.lang.String name, int numArgs, boolean multipleAllowed, java.lang.String help)
          Construct a new instance of the object.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Determine if two options are equal.
 java.lang.String getHelp()
          Get the help string, including option name.
 boolean getMultipleAllowed()
          Return true if the option maybe specified multiple times, resulting in a list of values.
 java.lang.String getName()
          Get the option name, including leading `-'.
 int getNumArgs()
          Get the number of arguments for a single instance of the option.
 int hashCode()
          Get the hashcode for the object.
protected abstract  void parse(java.lang.String[] args, java.lang.Object clientData)
          Parse an instance of the option.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected final java.lang.String name
The option name, including the leading `-'.


numArgs

protected final int numArgs
The number of arguments for the option.


multipleAllowed

protected final boolean multipleAllowed
Are multiple instances of the option allowed?


help

protected java.lang.String help
Help message for the option.

Constructor Detail

Option

public Option(java.lang.String name,
              int numArgs,
              boolean multipleAllowed,
              java.lang.String help)
Construct a new instance of the object.

Method Detail

getName

public java.lang.String getName()
Get the option name, including leading `-'.


getNumArgs

public int getNumArgs()
Get the number of arguments for a single instance of the option. If the option repeats, the actual number of arguments is a multiple of this.


getMultipleAllowed

public boolean getMultipleAllowed()
Return true if the option maybe specified multiple times, resulting in a list of values. Return false if the option can only be specified once.


getHelp

public java.lang.String getHelp()
Get the help string, including option name.


equals

public boolean equals(java.lang.Object obj)
Determine if two options are equal. Only the name is considered. It is illegal to have options with the same name and different attributes.


hashCode

public int hashCode()
Get the hashcode for the object.


parse

protected abstract void parse(java.lang.String[] args,
                              java.lang.Object clientData)
                       throws org.enhydra.xml.xmlc.XMLCException
Parse an instance of the option.