public abstract class Parameter extends AnnotatedEntity implements Cloneable
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
Modifier and Type | Field and Description |
---|---|
protected ParameterSet |
parent
If this
Parameter is enclosed in a ParameterSet , this
variable holds a reference to that ParameterSet . |
comment, datatype, name
Constructor and Description |
---|
Parameter(StringBuffer xml)
The standard constructor for the interface
Storable . |
Parameter(String name,
String comment,
DataType type)
The main constructor which takes the main information of a
Parameter . |
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). |
abstract boolean |
checkValue(Object value)
Checks the value for correctness, e.g.
|
Parameter |
clone() |
protected void |
extractFurtherInfos(StringBuffer source)
This method can be used in the constructor with parameter
StringBuffer to
extract the further information. |
abstract String |
getErrorMessage()
If a value could not be set successfully this method returns the
corresponding error message.
|
ParameterSet |
getParent()
Returns a reference to the
ParameterSet enclosing this
Parameter . |
abstract boolean |
hasDefaultOrIsSet()
Returns
true if the parameter either has a default value or
the value was set by the user, false otherwise. |
abstract boolean |
isAtomic()
Returns
true if the parameter is of an atomic data type,
false otherwise. |
boolean |
isComparable(Parameter p)
This method checks whether the given
Parameter is comparable to the current instance, i.e. |
abstract boolean |
isRequired()
|
abstract boolean |
isSet()
Returns
true if the parameter was set by the user,
false otherwise. |
abstract void |
reset()
Resets the parameter and its contents to the default values or
null if no defaults are given. |
abstract void |
setDefault(Object defaultValue)
Sets the default value of the
Parameter to
defaultValue . |
void |
setParent(ParameterSet parent)
|
abstract void |
setValue(Object value)
Sets the value of this
Parameter to value . |
getComment, getDatatype, getName, getValue, getXMLTag, toXML
protected ParameterSet parent
Parameter
is enclosed in a ParameterSet
, this
variable holds a reference to that ParameterSet
.public Parameter(String name, String comment, DataType type)
Parameter
.name
- the name of the resultcomment
- the comment for the resulttype
- the data type of the resultpublic Parameter(StringBuffer xml) throws NonParsableException
Storable
. Creates a
new Parameter
out of its XML representation.xml
- the XML representation as StringBuffer
NonParsableException
- if the XML representation is not parsableStorable
,
extractFurtherInfos(StringBuffer)
public abstract boolean isRequired()
true
if the Parameter
is required,
false
otherwisepublic abstract boolean checkValue(Object value)
value
- the value to be checkedtrue
if the value is valid, false
otherwisepublic abstract void setValue(Object value) throws SimpleParameter.IllegalValueException
Parameter
to value
.value
- the new value of the Parameter
SimpleParameter.IllegalValueException
- if the specified value is not valid for this
Parameter
public abstract boolean hasDefaultOrIsSet()
true
if the parameter either has a default value or
the value was set by the user, false
otherwise.true
if value has a default value or was set,
false
otherwisepublic abstract boolean isSet()
true
if the parameter was set by the user,
false
otherwise.true
if the parameter was set, false
otherwisepublic abstract boolean isAtomic()
true
if the parameter is of an atomic data type,
false
otherwise.true
if the parameter is atomic, false
otherwisepublic abstract String getErrorMessage()
public abstract void reset()
null
if no defaults are given.public Parameter clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public void setParent(ParameterSet parent)
parent
- the new enclosing ParameterSet
public ParameterSet getParent()
ParameterSet
enclosing this
Parameter
.ParameterSet
protected void extractFurtherInfos(StringBuffer source) throws NonParsableException
AnnotatedEntity
StringBuffer
to
extract the further information.extractFurtherInfos
in class AnnotatedEntity
source
- a XML represenation of the main information as
StringBuffer
NonParsableException
- if the XML representation is not parsableAnnotatedEntity.AnnotatedEntity(StringBuffer)
protected void appendFurtherInfos(StringBuffer buf)
AnnotatedEntity
Storable.toXML()
to extract
further information (name, comment, datatype).appendFurtherInfos
in class AnnotatedEntity
buf
- a XML representation of the main information as
StringBuffer
Storable.toXML()
public boolean isComparable(Parameter p)
Parameter
is comparable to the current instance, i.e. whether
the Class
, the DataType
, the name and the comment are identical. If necessary, all these
characteristics are checked recursively.
In other words, the method returns true
if the parameters only differ in their specific raw values.p
- the Parameter
for the comparisontrue
if the parameters only differ in their values, otherwise false
Object.getClass()
,
AnnotatedEntity.getDatatype()
,
AnnotatedEntity.getName()
,
AnnotatedEntity.getComment()
,
DataType.PARAMETERSET
,
ParameterSet.isComparable(ParameterSet)