com.mcdermottroe.exemplar.ui.options
Class Option<T extends Option<T>>

java.lang.Object
  extended by com.mcdermottroe.exemplar.ui.options.Option<T>
Type Parameters:
T - The type of Option this is.
All Implemented Interfaces:
Copyable<T>, Comparable<T>
Direct Known Subclasses:
Argument, Enum, Switch

public abstract class Option<T extends Option<T>>
extends Object
implements Comparable<T>, Copyable<T>

An option data type.

Since:
0.2

Field Summary
protected  boolean caseSensitive
          Whether or not the option is case sensitive.
protected  String description
          A textual description of the option.
protected  boolean mandatory
          Whether the option must be present or not.
protected  boolean multiValue
          Whether or not the option takes multiple values.
protected  String name
          The name of the option.
protected  List<String> value
          The current value(s) of the option.
 
Constructor Summary
protected Option(String optionName, String optionDesc, boolean optionMandatory, boolean optionMultiValue, boolean optionCaseSensitive)
          Simple constructor which initialises all of the member variables with given values.
 
Method Summary
 int compareTo(T other)
          Implement Comparable.compareTo(Object).
 boolean equals(Object o)
          See Object.equals(Object).
 String getDescription()
          Accessor for the description member.
 String getName()
          Accessor for the name member.
 List<String> getValue()
          Accessor for the value member.
 int hashCode()
          See Object.hashCode().
 boolean isCaseSensitive()
          Accessor for the caseSensitive member.
 boolean isMandatory()
          Accessor for the mandatory member.
 boolean isMultiValue()
          Accessor for the multiValue member.
 void setValue(List<String> newValue)
          Setter for the value member.
 String toString()
          See Object.toString().
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.mcdermottroe.exemplar.Copyable
getCopy
 

Field Detail

name

protected final String name
The name of the option.


value

protected List<String> value
The current value(s) of the option.


description

protected final String description
A textual description of the option.


mandatory

protected final boolean mandatory
Whether the option must be present or not.


multiValue

protected final boolean multiValue
Whether or not the option takes multiple values.


caseSensitive

protected final boolean caseSensitive
Whether or not the option is case sensitive.

Constructor Detail

Option

protected Option(String optionName,
                 String optionDesc,
                 boolean optionMandatory,
                 boolean optionMultiValue,
                 boolean optionCaseSensitive)
Simple constructor which initialises all of the member variables with given values.

Parameters:
optionName - The value for the member name.
optionDesc - The value for the member description.
optionMandatory - The value for the member mandatory.
optionMultiValue - The value for the member multiValue.
optionCaseSensitive - The value for the member caseSensitive.
Method Detail

compareTo

public int compareTo(T other)
Implement Comparable.compareTo(Object).

Specified by:
compareTo in interface Comparable<T extends Option<T>>
Parameters:
other - The Option to compare with.
Returns:
A result as defined by Comparable.compareTo(Object).

getName

public String getName()
Accessor for the name member.

Returns:
The value of the name member.

getValue

public List<String> getValue()
Accessor for the value member.

Returns:
A copy of the value of the name member.

setValue

public void setValue(List<String> newValue)
Setter for the value member.

Parameters:
newValue - The list to copy into the value member.

getDescription

public String getDescription()
Accessor for the description member.

Returns:
The value of the description member.

isMandatory

public boolean isMandatory()
Accessor for the mandatory member.

Returns:
The value of the mandatory member.

isMultiValue

public boolean isMultiValue()
Accessor for the multiValue member.

Returns:
The value of the multiValue member.

isCaseSensitive

public boolean isCaseSensitive()
Accessor for the caseSensitive member.

Returns:
The value of the caseSensitive member.

equals

public boolean equals(Object o)
See Object.equals(Object).

Overrides:
equals in class Object
Parameters:
o - The other object to compare with.
Returns:
True if this equals o.

hashCode

public int hashCode()
See Object.hashCode().

Overrides:
hashCode in class Object
Returns:
A hash code for this object.

toString

public String toString()
See Object.toString().

Overrides:
toString in class Object
Returns:
A descriptive String