|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.jstacs.parameters.validation.SimpleStaticConstraint
public class SimpleStaticConstraint
Class for a Constraint that checks values against static values using
the comparison operators defined in the interface Constraint. As long
as just an upper and lower bound shall be checked, NumberValidator
has the same functionality and is easier to use. Thus it is recommended to
use this class for more complex constraints, e.g. multiple allowed ranges or
combinations of static and reference-based constraints.
NumberValidator| Field Summary |
|---|
| Fields inherited from interface de.jstacs.parameters.validation.Constraint |
|---|
EQUALS, GEQ, GT, LEQ, LT |
| Constructor Summary | |
|---|---|
SimpleStaticConstraint(Number reference,
int comparisonOperator)
Creates a new SimpleStaticConstraint from a Number
-reference and a comparison operator as defined in Constraint. |
|
SimpleStaticConstraint(StringBuffer representation)
The standard constructor for the interface Storable. |
|
SimpleStaticConstraint(String reference,
int comparisonOperator)
Creates a new SimpleStaticConstraint from a String
-reference and a comparison operator as defined in Constraint. |
|
| Method Summary | |
|---|---|
boolean |
check(Object value)
Checks value for the constraint defined in the
Constraint. |
SimpleStaticConstraint |
clone()
This method returns a deep copy of the current instance. |
void |
fromXML(StringBuffer representation)
Parses a SimpleStaticConstraint from the XML representation as
returned by toXML(). |
String |
getErrorMessage()
Returns the message of the last error (missed constraint) or null if the constraint was fulfilled by the last checked
value. |
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 |
| Constructor Detail |
|---|
public SimpleStaticConstraint(Number reference,
int comparisonOperator)
SimpleStaticConstraint from a Number
-reference and a comparison operator as defined in Constraint.
reference - the Number-referencecomparisonOperator - the comparison operator
public SimpleStaticConstraint(String reference,
int comparisonOperator)
SimpleStaticConstraint from a String
-reference and a comparison operator as defined in Constraint.
reference - the String-referencecomparisonOperator - the comparison operator
public SimpleStaticConstraint(StringBuffer representation)
throws NonParsableException
Storable.
Creates a new SimpleStaticConstraint from its XML representation.
representation - the XML representation as StringBuffer
NonParsableException - if representation could not be parsed| Method Detail |
|---|
public SimpleStaticConstraint clone()
throws CloneNotSupportedException
Constraint
clone in interface Constraintclone in class ObjectCloneNotSupportedException - if the Constraint could not be clonedCloneablepublic boolean check(Object value)
Constraintvalue for the constraint defined in the
Constraint. If the constraint is fulfilled, true is
returned.
check in interface Constraintvalue - the Object to be checked
true if the constraint is fulfilled,
false otherwisepublic StringBuffer toXML()
StorableStringBuffer of an
instance of the implementing class.
toXML in interface Storable
public void fromXML(StringBuffer representation)
throws NonParsableException
SimpleStaticConstraint from the XML representation as
returned by toXML().
representation - the XML representation
NonParsableException - the XML code could not be parsedpublic String getErrorMessage()
Constraintnull if the constraint was fulfilled by the last checked
value.
getErrorMessage in interface Constraintnull
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||