|
||||||||||
| 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 Constraint-interface. 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 comparisonOperator as defined in Constraint. |
|
SimpleStaticConstraint(StringBuffer representation)
Creates a new SimpleStaticConstraint from its XML-representation |
|
SimpleStaticConstraint(String reference,
int comparisonOperator)
Creates a new SimpleStaticConstraint from a String-reference and
a comparisonOperator 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 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 comparisonOperator as defined in Constraint.
reference - the referencecomparisonOperator - the operator
public SimpleStaticConstraint(String reference,
int comparisonOperator)
SimpleStaticConstraint from a String-reference and
a comparisonOperator as defined in Constraint.
reference - the referencecomparisonOperator - the operator
public SimpleStaticConstraint(StringBuffer representation)
throws NonParsableException
SimpleStaticConstraint from its XML-representation
representation - the XML-representation
NonParsableException - is thrown 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.
Is the constraint is fulfilled, true is returned.
check in interface Constraintvalue - the value to be checked
public StringBuffer toXML()
Storable
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 - thrown if the XML-code could not be parsedpublic String getErrorMessage()
Constraintnull
if the constraint was fulfilled by the last checked value
getErrorMessage in interface Constraint
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||