Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.jstacs.parameters
Class EnumParameter

    java.lang.Object
      de.jstacs.parameters.Parameter
          de.jstacs.parameters.CollectionParameter
              de.jstacs.parameters.EnumParameter

All Implemented Interfaces:
  Rangeable, Storable, Cloneable

    public class EnumParameter

extends CollectionParameter

This class implements a `CollectionParameter` based on an Enum. Internally it is based on string, i.e. the names of the enum constants. The methods `Parameter.setDefault(Object)` and `Parameter.setValue(Object)` can be used with Strings or with the Enum constants.

Author:
  Jens Keilwagen

Nested Class Summary

Nested classes/interfaces inherited from class de.jstacs.parameters.CollectionParameter
`CollectionParameter.InconsistentCollectionException`

Field Summary

Fields inherited from class de.jstacs.parameters.CollectionParameter
`errorMessage, parameters, userSelected`

Fields inherited from class de.jstacs.parameters.Parameter
`neededReference, neededReferenceId, parent`

Constructor Summary
`EnumParameter(Class<? extends Enum> enumInstance, String comment, boolean required)` The main constructor.
`EnumParameter(StringBuffer representation)` Restores an instance of `EnumParameter` from a string representation

Method Summary
`protected void` | `appendCollection(StringBuffer buf)` Appends the internal `ParameterSet` in its XML-representation (`ParameterSet.toXML()`) to `buf`
`protected void` | `extractCollection(StringBuffer buf)` Extracts the internal `ParameterSet` from its XML-representation (`ParameterSet.toXML()`).
`Enum` | `getValue()` Returns the current value of this `Parameter`
`void` | `setDefault(Object defaultValue)` Sets the default value of the parameter to `defaultValue`
`void` | `setValue(Object value)` Sets the selected value to the one that is specified by the key `value`

Methods inherited from class de.jstacs.parameters.CollectionParameter
`checkValue, clone, createParameterSet, equals, fromXML, getComment, getDatatype, getDefault, getErrorMessage, getName, getParametersInCollection, getRangedInstance, getSelected, hasDefault, hasDefaultOrIsSet, isAtomic, isRangeable, isRequired, isSet, isUserSelected, reset, setRangeable, simplify, toXML`

Methods inherited from class de.jstacs.parameters.Parameter
`getId, getNeededReference, getNeededReferenceId, getParent, setNeededReference, setParent`

Methods inherited from class java.lang.Object
`finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### EnumParameter

    public EnumParameter(Class<? extends Enum> enumInstance,
                         String comment,
                         boolean required)
                  throws ParameterException

  The main constructor.

  Parameters:
    `enumInstance` - the enum class, e.q. `Sample.PartitionMethod`.class
    `comment` - the comment for this parameter
    `required` - `true` if this `EnumParameter` is required
  Throws:
    `ParameterException` - is never thrown but exists due to the class hierarchy

### EnumParameter

    public EnumParameter(StringBuffer representation)
                  throws NonParsableException

  Restores an instance of `EnumParameter` from a string representation

  Parameters:
    `representation` - the string representation
  Throws:
    `NonParsableException` - if the representation could not be parsed to a `CollectionParameter`, a `NonParsableException` is thrown

Method Detail

### appendCollection

    protected void appendCollection(StringBuffer buf)

  Description copied from class: `CollectionParameter`
  Appends the internal `ParameterSet` in its XML-representation (`ParameterSet.toXML()`) to `buf`

  Overrides:
    `appendCollection` in class `CollectionParameter`
  Parameters:
    `buf` - the `StringBuffer` this method appends to

### extractCollection

    protected void extractCollection(StringBuffer buf)
                              throws NonParsableException

  Description copied from class: `CollectionParameter`
  Extracts the internal `ParameterSet` from its XML-representation (`ParameterSet.toXML()`). Reverse method to `CollectionParameter.appendCollection(StringBuffer)`.

  Overrides:
    `extractCollection` in class `CollectionParameter`
  Parameters:
    `buf` - the `StringBuffer` containing the XML-representation
  Throws:
    `NonParsableException` - is thrown if the XML-code could not be parsed

### getValue

    public Enum getValue()

  Description copied from class: `Parameter`
  Returns the current value of this `Parameter`

  Overrides:
    `getValue` in class `CollectionParameter`
  Returns:
    the current value

### setValue

    public void setValue(Object value)
                  throws SimpleParameter.IllegalValueException

  Description copied from class: `CollectionParameter`
  Sets the selected value to the one that is specified by the key `value`

  Overrides:
    `setValue` in class `CollectionParameter`
  Parameters:
    `value` - the key of the desired value
  Throws:
    `SimpleParameter.IllegalValueException` - if the specified value is not valid for this `Parameter` an `IllegalValueException` is thrown

### setDefault

    public void setDefault(Object defaultValue)
                    throws SimpleParameter.IllegalValueException

  Description copied from class: `Parameter`
  Sets the default value of the parameter to `defaultValue`

  Overrides:
    `setDefault` in class `CollectionParameter`
  Parameters:
    `defaultValue` - the default value
  Throws:
    `SimpleParameter.IllegalValueException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD