|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
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 a 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, false otherwise. |
abstract boolean |
isAtomic()
Returns true if the parameter is of an atomic data type,
false otherwise. |
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,
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 |
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 as StringBuffer 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
.
Parameter
public abstract String getName()
Parameter
.
Parameter
public abstract DataType getDatatype()
Parameter
.
Parameter
public abstract String getComment()
Parameter
that tells something about
useful values, domains, usage of this parameter, etc.
public abstract boolean isRequired()
true
if the Parameter
is required,
false
otherwise.
true
if the Parameter
is required,
false
otherwisepublic abstract boolean checkValue(Object value)
value
- the value to be checked
true
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 Object getValue()
Parameter
.
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 ParameterSet getNeededReference()
ParameterSet
whose
ParameterSet.hasDefaultOrIsSet()
-method depends on the value of
this Parameter
. If no such ParameterSet
exists,
null
is returned.
ParameterSet
ParameterSet.hasDefaultOrIsSet()
public Long getNeededReferenceId()
ParameterSet
that would be returned by
getNeededReference()
.
ParameterSet
getNeededReference()
public void setNeededReference(ParameterSet reference)
ParameterSet
whose validity
depends on the value of this Parameter
.
reference
- to the ParameterSet
depending on the value of this
Parameter
public 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 simplify()
Parameter
and its contents to the relevant
information. This could be e.g. to reset the contents of those values of
a CollectionParameter
that are not selected.
public abstract void reset()
null
if no defaults are given.
public Parameter clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public abstract void setDefault(Object defaultValue) throws Exception
Parameter
to
defaultValue
.
defaultValue
- the default value
Exception
- 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 a XML representation as returned by
toXML()
.
source
- the XML representation as StringBuffer
NonParsableException
- if the XML code could not be parsedtoXML()
public StringBuffer toXML()
Storable
StringBuffer
of an
instance of the implementing class.
toXML
in interface Storable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |