|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.jstacs.parameters.validation.ConstraintValidator
public class ConstraintValidator
Class for a ParameterValidator that is based on Constraints.
Each instance of a ConstraintValidator may contain a set of
constraints that are all fulfilled, if checkValue(Object) returns
true.
| Constructor Summary | |
|---|---|
ConstraintValidator()
Creates a new ConstraintValidator having an empty list of
Constraints, i.e. the constraints of this
ConstraintValidator are always fulfilled before additional
Constraints are added using addConstraint(Constraint). |
|
ConstraintValidator(StringBuffer representation)
The standard constructor for the interface Storable. |
|
| Method Summary | |
|---|---|
void |
addConstraint(Constraint c)
Adds an additional Constraint to the list of Constraints. |
boolean |
checkValue(Object value)
Returns true if the value is valid and false
otherwise. |
ConstraintValidator |
clone()
This method returns a deep copy of the current instance. |
void |
fromXML(StringBuffer representation)
Parses a ConstraintValidator from the XML representation as
returned by toXML(). |
String |
getErrorMessage()
Returns the error message if ParameterValidator.checkValue(Object) returned false. |
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 ConstraintValidator()
ConstraintValidator having an empty list of
Constraints, i.e. the constraints of this
ConstraintValidator are always fulfilled before additional
Constraints are added using addConstraint(Constraint).
public ConstraintValidator(StringBuffer representation)
throws NonParsableException
Storable.
Creates a new ConstraintValidator from its XML representation.
representation - the XML representation as StringBuffer
NonParsableException - if representation could not be parsed| Method Detail |
|---|
public ConstraintValidator clone()
throws CloneNotSupportedException
ParameterValidator
clone in interface ParameterValidatorclone in class ObjectCloneNotSupportedException - if the ParameterValidator could not be clonedCloneablepublic void addConstraint(Constraint c)
Constraint to the list of Constraints.
c - the Constraint to be addedpublic boolean checkValue(Object value)
ParameterValidatortrue if the value is valid and false
otherwise.
checkValue in interface ParameterValidatorvalue - the Object to be checked
value is validpublic String getErrorMessage()
ParameterValidatorParameterValidator.checkValue(Object) returned false.
getErrorMessage in interface ParameterValidatorpublic StringBuffer toXML()
StorableStringBuffer of an
instance of the implementing class.
toXML in interface Storablepublic void fromXML(StringBuffer representation)
throws NonParsableException
ConstraintValidator from the XML representation as
returned by toXML().
representation - the XML representation
NonParsableException - if the XML code could not be parsed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||