de.jstacs.parameters
Class EnumParameter
java.lang.Object
de.jstacs.AnnotatedEntity
de.jstacs.parameters.Parameter
de.jstacs.parameters.AbstractSelectionParameter
de.jstacs.parameters.SelectionParameter
de.jstacs.parameters.EnumParameter
- All Implemented Interfaces:
- GalaxyConvertible, Rangeable, Storable, Cloneable
public class EnumParameter
- extends SelectionParameter
This class implements a SelectionParameter based on an Enum.
Internally it is based on Strings, i.e. the names of the Enum
constants. The methods setDefault(Object) and
setValue(Object) can be used with Strings or with the
Enum constants.
- Author:
- Jens Keilwagen
| Methods inherited from class de.jstacs.parameters.AbstractSelectionParameter |
check, checkValue, clone, createParameterSet, equals, getParametersInCollection, getRangedInstance, isAtomic, isRangeable, isRequired, isSet, isUserSelected, setRangeable, toGalaxy |
EnumParameter
public EnumParameter(Class<? extends Enum> enumInstance,
String comment,
boolean required)
throws ParameterException
- The main constructor.
- Parameters:
enumInstance - the Enum class, e.g.
DataSet.PartitionMethod.classcomment - a comment on this parameterrequired - 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.
DataSet.PartitionMethod.classcomment - a comment on this parameterrequired - true if this EnumParameter is required,
false otherwisedefaultValue - 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
appendFurtherInfos
protected void appendFurtherInfos(StringBuffer buf)
- Description copied from class:
AnnotatedEntity
- This method can be used in the method
Storable.toXML() to extract
further information (name, comment, datatype).
- Overrides:
appendFurtherInfos in class SelectionParameter
- Parameters:
buf - a XML representation of the main information as
StringBuffer- See Also:
Storable.toXML()
extractFurtherInfos
protected void extractFurtherInfos(StringBuffer buf)
throws NonParsableException
- Description copied from class:
AnnotatedEntity
- This method can be used in the constructor with parameter
StringBuffer to
extract the further information.
- Overrides:
extractFurtherInfos in class SelectionParameter
- Parameters:
buf - a XML represenation of the main information as
StringBuffer
- Throws:
NonParsableException - if the XML representation is not parsable- See Also:
AnnotatedEntity.AnnotatedEntity(StringBuffer)
getValue
public Enum getValue()
- Description copied from class:
AnnotatedEntity
- Returns the value of the
AnnotatedEntity.
- Overrides:
getValue in class SelectionParameter
- Returns:
- the value of the
AnnotatedEntity
setValue
public void setValue(Object value)
throws SimpleParameter.IllegalValueException
- Description copied from class:
SelectionParameter
- Sets the selected value to the one that is specified by the key
value.
- Overrides:
setValue in class SelectionParameter
- 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:
AbstractSelectionParameter
- Sets the default value of this
AbstractSelectionParameter to
defaultValue. This method also sets the current
value of this AbstractSelectionParameter to the default
and resets it such that AbstractSelectionParameter.isUserSelected()
returns false.
- Overrides:
setDefault in class SelectionParameter
- Parameters:
defaultValue - the default value
- Throws:
SimpleParameter.IllegalValueException