|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| 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, 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.
| 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 |
|---|
public EnumParameter(Class<? extends Enum> enumInstance,
String comment,
boolean required)
throws ParameterException
enumInstance - the enum class, e.q. Sample.PartitionMethod.classcomment - the comment for this parameterrequired - true if this EnumParameter is required
ParameterException - is never thrown but exists due to the class hierarchy
public EnumParameter(StringBuffer representation)
throws NonParsableException
EnumParameter from a string representation
representation - the string representation
NonParsableException - if the representation could not be parsed to a CollectionParameter, a NonParsableException is thrown| Method Detail |
|---|
protected void appendCollection(StringBuffer buf)
CollectionParameterParameterSet in its XML-representation (ParameterSet.toXML()) to buf
appendCollection in class CollectionParameterbuf - the StringBuffer this method appends to
protected void extractCollection(StringBuffer buf)
throws NonParsableException
CollectionParameterParameterSet from its XML-representation (ParameterSet.toXML()).
Reverse method to CollectionParameter.appendCollection(StringBuffer).
extractCollection in class CollectionParameterbuf - the StringBuffer containing the XML-representation
NonParsableException - is thrown if the XML-code could not be parsedpublic Enum getValue()
ParameterParameter
getValue in class CollectionParameter
public void setValue(Object value)
throws SimpleParameter.IllegalValueException
CollectionParametervalue
setValue in class CollectionParametervalue - the key of the desired value
SimpleParameter.IllegalValueException - if the specified value is not valid for this Parameter an IllegalValueException is thrown
public void setDefault(Object defaultValue)
throws SimpleParameter.IllegalValueException
ParameterdefaultValue
setDefault in class CollectionParameterdefaultValue - the default value
SimpleParameter.IllegalValueException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||