|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.jstacs.AnnotatedEntity
de.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.
Parameters should always be
embedded into a ParameterSet and then passed to the respective
method.
ParameterSet| Field Summary | |
|---|---|
protected ParameterSet |
parent
If this Parameter is enclosed in a ParameterSet, this
variable holds a reference to that ParameterSet. |
| Fields inherited from class de.jstacs.AnnotatedEntity |
|---|
comment, datatype, name |
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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()
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 |
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. |
| Methods inherited from class de.jstacs.AnnotatedEntity |
|---|
getComment, getDatatype, getName, getValue, getXMLTag, toXML |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ParameterSet parent
Parameter is enclosed in a ParameterSet, this
variable holds a reference to that ParameterSet.
| Constructor Detail |
|---|
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 result
public 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)| Method Detail |
|---|
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
otherwise
public 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
Parameterpublic 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 ObjectCloneNotSupportedException
public abstract void setDefault(Object defaultValue)
throws Exception
Parameter to
defaultValue. This method also sets the current
value of this Parameter to the default.
defaultValue - the default value
Exception - if the default value is not an appropriate value for this
Parameterpublic void setParent(ParameterSet parent)
ParameterSet of this
Parameter to parent.
parent - the new enclosing ParameterSetpublic ParameterSet getParent()
ParameterSet enclosing this
Parameter.
ParameterSet
protected void extractFurtherInfos(StringBuffer source)
throws NonParsableException
AnnotatedEntityStringBuffer to
extract the further information.
extractFurtherInfos in class AnnotatedEntitysource - a XML represenation of the main information as
StringBuffer
NonParsableException - if the XML representation is not parsableAnnotatedEntity.AnnotatedEntity(StringBuffer)protected void appendFurtherInfos(StringBuffer buf)
AnnotatedEntityStorable.toXML() to extract
further information (name, comment, datatype).
appendFurtherInfos in class AnnotatedEntitybuf - a XML representation of the main information as
StringBufferStorable.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 comparison
true if the parameters only differ in their values, otherwise falseObject.getClass(),
AnnotatedEntity.getDatatype(),
AnnotatedEntity.getName(),
AnnotatedEntity.getComment(),
DataType.PARAMETERSET,
ParameterSet.isComparable(ParameterSet)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||