com.mcdermottroe.exemplar.ui.options
Class Enum

java.lang.Object
  extended by com.mcdermottroe.exemplar.ui.options.Option<Enum>
      extended by com.mcdermottroe.exemplar.ui.options.Enum
All Implemented Interfaces:
Copyable<Enum>, Comparable<Enum>

public class Enum
extends Option<Enum>

Option type for dealing with enumerated options. These are options that take one or more values from a fixed set.

Since:
0.2

Field Summary
protected  Map<String,String> enumValues
          The allowed values.
 
Fields inherited from class com.mcdermottroe.exemplar.ui.options.Option
caseSensitive, description, mandatory, multiValue, name, value
 
Constructor Summary
Enum(String enumName, String enumDesc, Map<String,String> enumVals, boolean isMandatory, boolean isMultiValue, boolean isCaseSensitive, Set<String> defaultValues)
          Constructor that just initializes the member variables.
 
Method Summary
 int compareTo(Enum other)
          Implement Comparable.compareTo(Object).
 Enum getCopy()
          Creates a deep copy of the current object and returns it.
 Map<String,String> getEnumValues()
          Accessor for the allowed values of this Enum.
 
Methods inherited from class com.mcdermottroe.exemplar.ui.options.Option
equals, getDescription, getName, getValue, hashCode, isCaseSensitive, isMandatory, isMultiValue, setValue, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

enumValues

protected final Map<String,String> enumValues
The allowed values.

Constructor Detail

Enum

public Enum(String enumName,
            String enumDesc,
            Map<String,String> enumVals,
            boolean isMandatory,
            boolean isMultiValue,
            boolean isCaseSensitive,
            Set<String> defaultValues)
Constructor that just initializes the member variables.

Parameters:
enumName - The name of this enumerated option.
enumDesc - A description of what this option is for.
enumVals - The values that this option may take. This is a map where the keys are the values that the Enum may take and the values are the descriptions of what those values do.
isMandatory - Set if this option must be set by the user.
isMultiValue - Set if more than one value from the fixed set can be passed to this option.
isCaseSensitive - Set if the value(s) given are case sensitive.
defaultValues - Default value(s) to set this option to.
Method Detail

compareTo

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

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

getEnumValues

public Map<String,String> getEnumValues()
Accessor for the allowed values of this Enum.

Returns:
A copy of the Map where the keys are the allowed values for this Enum and the values are the descriptions of what the values do.

getCopy

public Enum getCopy()
Creates a deep copy of the current object and returns it.

Returns:
A deep copy of the current object.