|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.parameters.Parameter
public abstract class Parameter
Abstract class for a parameter that shall be used as the parameter of some method, constructor, etc.
This class provides annotation of the parameter, e.g. a name and a comment, the data type, and additional properties for non-atomic
parameters. The intention of the Parameter
classes is to link this annotation directly to the parameter values, which could
not be achieved by primitive data types.
Parameter
s should always be embedded into a ParameterSet
and then passed to the respective method.
ParameterSet
Field Summary | |
---|---|
protected ParameterSet |
neededReference
In cases, when the validity of some ParameterSet
depends on the value of this Parameter , this variable holds a reference
to that ParameterSet |
protected Long |
neededReferenceId
In addition to the reference, the id of the ParameterSet
is saved, which assists reconstruction from XML. |
protected ParameterSet |
parent
If this Parameter is enclosed in a ParameterSet ,
this variable holds a reference to that ParameterSet . |
Constructor Summary | |
---|---|
Parameter()
Creates a new Parameter and generates the internal id. |
Method Summary | |
---|---|
abstract boolean |
checkValue(Object value)
Checks the value for correctness, e.g. for numerical parameters this might be checking if the value is within specified bounds |
Parameter |
clone()
|
protected void |
fromXML(StringBuffer source)
Parses a Parameter from an XML-representation as returned by toXML() . |
abstract String |
getComment()
Returns a comment on this parameter that tells something about useful values, domains, usage of this parameter, etc. |
abstract DataType |
getDatatype()
Returns the data type of the parameter |
abstract String |
getErrorMessage()
If a value could not be set successfully this method returns the corresponding error message. |
long |
getId()
Returns the id of this Parameter . |
abstract String |
getName()
Returns the name of the parameter |
ParameterSet |
getNeededReference()
Returns a reference to a ParameterSet whose ParameterSet.hasDefaultOrIsSet() method depends on the value of this Parameter . |
Long |
getNeededReferenceId()
Returns the id of the ParameterSet that would be returned by getNeededReference() . |
ParameterSet |
getParent()
Returns a reference to the ParameterSet enclosing this Parameter . |
abstract Object |
getValue()
Returns the current value of this Parameter |
abstract boolean |
hasDefaultOrIsSet()
Returns true if the parameter either has a default value or the value was set by the user. |
abstract boolean |
isAtomic()
Returns true if the parameter is of an atomic data type |
abstract boolean |
isRequired()
Returns true if the parameter is required, false otherwise |
abstract boolean |
isSet()
Returns true if the parameter was set by the user. |
abstract void |
reset()
Resets the parameter and its contents to the default values or null if not
defaults are given. |
abstract void |
setDefault(Object defaultValue)
Sets the default value of the parameter to defaultValue |
void |
setNeededReference(ParameterSet reference)
Sets an internal reference to a ParameterSet whose validity depends on
the value of this Parameter . |
void |
setParent(ParameterSet parent)
Sets the reference of the enclosing ParameterSet of this
Parameter to parent . |
abstract void |
setValue(Object value)
Sets the value of this parameter to value . |
abstract void |
simplify()
Simplifies the Parameter and its contents to the relevant information. |
StringBuffer |
toXML()
This method returns an XML-representation of an instance of the implementing class. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ParameterSet neededReference
ParameterSet
depends on the value of this Parameter
, this variable holds a reference
to that ParameterSet
protected Long neededReferenceId
ParameterSet
is saved, which assists reconstruction from XML.
neededReference
protected ParameterSet parent
Parameter
is enclosed in a ParameterSet
,
this variable holds a reference to that ParameterSet
.
Constructor Detail |
---|
public Parameter()
Parameter
and generates the internal id.
Method Detail |
---|
public long getId()
Parameter
.
public abstract String getName()
public abstract DataType getDatatype()
public abstract String getComment()
public abstract boolean isRequired()
true
if the parameter is required, false
otherwise
public abstract boolean checkValue(Object value)
value
- the value to be checked
public abstract void setValue(Object value) throws SimpleParameter.IllegalValueException
value
.
value
- the new value
SimpleParameter.IllegalValueException
- if the specified value is not valid for this Parameter
an IllegalValueException
is thrownpublic abstract Object getValue()
Parameter
public abstract boolean hasDefaultOrIsSet()
public ParameterSet getNeededReference()
ParameterSet
whose ParameterSet.hasDefaultOrIsSet()
method depends on the value of this Parameter
.
If no such ParameterSet
exists, null
is returned.
public Long getNeededReferenceId()
ParameterSet
that would be returned by getNeededReference()
.
public void setNeededReference(ParameterSet reference)
ParameterSet
whose validity depends on
the value of this Parameter
.
reference
- the ParameterSet
depending on the value of this Parameter
public abstract boolean isSet()
public abstract boolean isAtomic()
public abstract String getErrorMessage()
public abstract void simplify()
CollectionParameter
that are not
selected.
public abstract void reset()
null
if not
defaults are given.
public Parameter clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public abstract void setDefault(Object defaultValue) throws Exception
defaultValue
defaultValue
- the default value
Exception
- throws an Exceptio
if the default value is not an appropriate value
for this parameter.public void setParent(ParameterSet parent)
ParameterSet
of this
Parameter
to parent
.
parent
- the new enclosing ParameterSet
public ParameterSet getParent()
ParameterSet
enclosing this Parameter
.
ParameterSet
protected void fromXML(StringBuffer source) throws NonParsableException
Parameter
from an XML-representation as returned by toXML()
.
source
- the XML-representation
NonParsableException
- is thrown if the XML-code could not be parsedpublic StringBuffer toXML()
Storable
toXML
in interface Storable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |