public class EnumParameter extends SelectionParameter
SelectionParameter
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.AbstractSelectionParameter.InconsistentCollectionException
errorMessage, parameters, userSelected
comment, datatype, name
Constructor and Description |
---|
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 . |
Modifier and Type | Method and Description |
---|---|
protected void |
appendFurtherInfos(StringBuffer buf)
This method can be used in the method
Storable.toXML() to extract
further information (name, comment, datatype). |
protected void |
extractFurtherInfos(StringBuffer buf)
This method can be used in the constructor with parameter
StringBuffer to
extract the further information. |
Enum |
getValue()
Returns the value of the
AnnotatedEntity . |
void |
setDefault(Object defaultValue)
Sets the default value of this
AbstractSelectionParameter to
defaultValue . |
void |
setValue(Object value)
Sets the selected value to the one that is specified by the key
value . |
fromGalaxy, getDefault, getErrorMessage, getSelected, getXMLTag, hasDefault, hasDefaultOrIsSet, isSelected, reset, toString
check, checkValue, clone, createParameterSet, equals, getParametersInCollection, getRangedInstance, isAtomic, isComparable, isRangeable, isRequired, isSet, isUserSelected, setRangeable, toGalaxy
getComment, getDatatype, getName, toXML
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getRangedInstance, isRangeable
toGalaxy
public EnumParameter(Class<? extends Enum> enumInstance, String comment, boolean required) throws ParameterException
enumInstance
- the Enum
class, e.g.
DataSet.PartitionMethod
.classcomment
- a comment on this parameterrequired
- true
if this EnumParameter
is required,
false
otherwiseParameterException
- is never thrown but exists due to the class hierarchypublic EnumParameter(Class<? extends Enum> enumInstance, String comment, boolean required, String defaultValue) throws ParameterException
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 parameterParameterException
- is never thrown but exists due to the class hierarchyEnumParameter(Class, String, boolean)
,
setDefault(Object)
public EnumParameter(StringBuffer representation) throws NonParsableException
Storable
.
Restores an instance of EnumParameter
from a XML representation.representation
- the XML representation as StringBuffer
NonParsableException
- if the StringBuffer
representation
could
not be parsedprotected void appendFurtherInfos(StringBuffer buf)
AnnotatedEntity
Storable.toXML()
to extract
further information (name, comment, datatype).appendFurtherInfos
in class SelectionParameter
buf
- a XML representation of the main information as
StringBuffer
Storable.toXML()
protected void extractFurtherInfos(StringBuffer buf) throws NonParsableException
AnnotatedEntity
StringBuffer
to
extract the further information.extractFurtherInfos
in class SelectionParameter
buf
- a XML represenation of the main information as
StringBuffer
NonParsableException
- if the XML representation is not parsableAnnotatedEntity.AnnotatedEntity(StringBuffer)
public Enum getValue()
AnnotatedEntity
AnnotatedEntity
.getValue
in class SelectionParameter
AnnotatedEntity
public void setValue(Object value) throws SimpleParameter.IllegalValueException
SelectionParameter
value
.setValue
in class SelectionParameter
value
- the key of the desired valueSimpleParameter.IllegalValueException
- if the specified value is not valid for this
Parameter
public void setDefault(Object defaultValue) throws SimpleParameter.IllegalValueException
AbstractSelectionParameter
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
.setDefault
in class SelectionParameter
defaultValue
- the default valueSimpleParameter.IllegalValueException