snaq.util.jclap
Class Option<E>

java.lang.Object
  extended by snaq.util.jclap.Option<E>
Type Parameters:
E - the return type of the option
Direct Known Subclasses:
BooleanOption, DateOption, DoubleOption, EnumeratedOption, FloatOption, IntegerOption, LongOption, StringOption

public abstract class Option<E>
extends java.lang.Object

Base implementation of a command-line option.

Author:
Giles Winstanley

Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getDescription()
          Returns the description text of this Option.
 java.lang.String getLongName()
          Returns the long name of this option.
 int getMaxCount()
          Returns the maximum value count for this option.
 int getMinCount()
          Returns the minimum value count for this option.
 java.lang.String getShortName()
          Returns the short name of this option.
abstract  java.lang.Class<E> getType()
          Returns the class type of value this option can take.
 java.util.List<E> getValues()
          Returns the mapped value of the specified argument if it exists.
 int hashCode()
           
 boolean isAllowMany()
          Returns whether this option allows multiple values to be set.
 boolean isHidden()
          Returns whether this option is hidden from the usage message.
 boolean isMandatory()
          Returns whether this option is mandatory.
 boolean requiresValue()
          Returns whether this option requires a value.
 Option<E> setHidden()
          Sets the flag to hide this option from the usage message.
 void setMinMaxCounts(int minCount, int maxCount)
          Sets the minimum/maximum value counts for this option.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getType

public abstract java.lang.Class<E> getType()
Returns the class type of value this option can take.


getValues

public java.util.List<E> getValues()
Returns the mapped value of the specified argument if it exists.


getShortName

public java.lang.String getShortName()
Returns the short name of this option.


getLongName

public java.lang.String getLongName()
Returns the long name of this option.


getDescription

public java.lang.String getDescription()
Returns the description text of this Option.


requiresValue

public boolean requiresValue()
Returns whether this option requires a value.


getMinCount

public int getMinCount()
Returns the minimum value count for this option.


getMaxCount

public int getMaxCount()
Returns the maximum value count for this option.


isMandatory

public boolean isMandatory()
Returns whether this option is mandatory.


isAllowMany

public boolean isAllowMany()
Returns whether this option allows multiple values to be set.


setMinMaxCounts

public void setMinMaxCounts(int minCount,
                            int maxCount)
Sets the minimum/maximum value counts for this option.


setHidden

public Option<E> setHidden()
Sets the flag to hide this option from the usage message.


isHidden

public boolean isHidden()
Returns whether this option is hidden from the usage message.