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`s, i.e. the names of the `Enum` constants. The methods `setDefault(Object)` and `setValue(Object)` can be used with `String`s 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(Class<? extends Enum> enumInstance, String comment, boolean required, String defaultValue)` This constructor creates an instance and set the default value.
`EnumParameter(StringBuffer representation)` The standard constructor for the interface `Storable`.

Method Summary
`protected void` | `appendCollection(StringBuffer buf)` Appends the internal `ParameterSet` in its XML representation ( `ParameterSet.toXML()`) to the `StringBuffer` `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, toString, 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, 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.g. `Sample.PartitionMethod`.class
    `comment` - a comment on this parameter
    `required` - `true` if this `EnumParameter` is required, `false` otherwise
  Throws:
    `ParameterException` - is never thrown but exists due to the class hierarchy

### EnumParameter

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

  This constructor creates an instance and set the default value.

  Parameters:
    `enumInstance` - the `Enum` class, e.g. `Sample.PartitionMethod`.class
    `comment` - a comment on this parameter
    `required` - `true` if this `EnumParameter` is required, `false` otherwise
    `defaultValue` - the default value of this parameter
  Throws:
    `ParameterException` - is never thrown but exists due to the class hierarchy
  See Also:
    `EnumParameter(Class, String, boolean)`, `setDefault(Object)`

### EnumParameter

    public EnumParameter(StringBuffer representation)
                  throws NonParsableException

  The standard constructor for the interface `Storable`. Restores an instance of `EnumParameter` from a XML representation.

  Parameters:
    `representation` - the XML representation as `StringBuffer`
  Throws:
    `NonParsableException` - if the `StringBuffer` `representation` could not be parsed

Method Detail

### appendCollection

    protected void appendCollection(StringBuffer buf)

  Description copied from class: `CollectionParameter`
  Appends the internal `ParameterSet` in its XML representation ( `ParameterSet.toXML()`) to the `StringBuffer` `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` - 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 of the `Parameter`

### 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`

### 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