|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.parameters.Parameter
de.jstacs.parameters.CollectionParameter
de.jstacs.parameters.EnumParameter
public class EnumParameter
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.
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, fromGalaxy, fromXML, getComment, getDatatype, getDefault, getErrorMessage, getName, getParametersInCollection, getRangedInstance, getSelected, hasDefault, hasDefaultOrIsSet, isAtomic, isRangeable, isRequired, isSelected, isSet, isUserSelected, reset, setRangeable, simplify, toGalaxy, 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 |
---|
public EnumParameter(Class<? extends Enum> enumInstance, String comment, boolean required) throws ParameterException
enumInstance
- the Enum
class, e.g.
Sample.PartitionMethod
.classcomment
- a comment on this parameterrequired
- true
if this EnumParameter
is required,
false
otherwise
ParameterException
- 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.
Sample.PartitionMethod
.classcomment
- a comment on this parameterrequired
- true
if this EnumParameter
is required,
false
otherwisedefaultValue
- the default value of this parameter
ParameterException
- 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 parsedMethod Detail |
---|
protected void appendCollection(StringBuffer buf)
CollectionParameter
ParameterSet
in its XML representation (
ParameterSet.toXML()
) to the StringBuffer
buf
.
appendCollection
in class CollectionParameter
buf
- the StringBuffer
this method appends toprotected void extractCollection(StringBuffer buf) throws NonParsableException
CollectionParameter
ParameterSet
from its XML representation (
ParameterSet.toXML()
). Reverse method to
CollectionParameter.appendCollection(StringBuffer)
.
extractCollection
in class CollectionParameter
buf
- the StringBuffer
containing the XML representation
NonParsableException
- if the XML code could not be parsedpublic Enum getValue()
Parameter
Parameter
.
getValue
in class CollectionParameter
Parameter
public void setValue(Object value) throws SimpleParameter.IllegalValueException
CollectionParameter
value
.
setValue
in class CollectionParameter
value
- the key of the desired value
SimpleParameter.IllegalValueException
- if the specified value is not valid for this
Parameter
public void setDefault(Object defaultValue) throws SimpleParameter.IllegalValueException
Parameter
Parameter
to
defaultValue
.
setDefault
in class CollectionParameter
defaultValue
- the default value
SimpleParameter.IllegalValueException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |