de.jstacs.parameters.validation
Class SimpleReferenceConstraint

java.lang.Object
  extended by de.jstacs.parameters.validation.ReferenceConstraint
      extended by de.jstacs.parameters.validation.SimpleReferenceConstraint
All Implemented Interfaces:
Constraint, Storable, Cloneable

public class SimpleReferenceConstraint
extends ReferenceConstraint

Class for a ReferenceConstraint that checks for "simple" conditions as defined in the Constraint-interface.

Author:
Jan Grau

Field Summary
 
Fields inherited from class de.jstacs.parameters.validation.ReferenceConstraint
constraintParameter, errorMessage
 
Fields inherited from interface de.jstacs.parameters.validation.Constraint
EQUALS, GEQ, GT, LEQ, LT
 
Constructor Summary
SimpleReferenceConstraint(SimpleParameter constraintParameter, int comparisonOperator)
          Creates a new SimpleReferenceConstraint from a reference SimpleParameter and a comparison operator, which is one of the values defined in the Constraint-interface.
SimpleReferenceConstraint(StringBuffer representation)
          Creates a new SimpleReferenceConstraint from its XML-representation.
 
Method Summary
 boolean check(Object value)
          Checks value for the constraint defined in the Constraint.
 SimpleReferenceConstraint clone()
          This method returns a deep copy of the current instance.
 void fromXML(StringBuffer representation)
          Parses a ReferenceConstraint from the XML-representation as returned by ReferenceConstraint.toXML().
 StringBuffer toXML()
          This method returns an XML-representation of an instance of the implementing class.
 
Methods inherited from class de.jstacs.parameters.validation.ReferenceConstraint
fillWithStandardFieldForClone, getErrorMessage
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleReferenceConstraint

public SimpleReferenceConstraint(SimpleParameter constraintParameter,
                                 int comparisonOperator)
Creates a new SimpleReferenceConstraint from a reference SimpleParameter and a comparison operator, which is one of the values defined in the Constraint-interface.

Parameters:
constraintParameter - the reference
comparisonOperator - the operator

SimpleReferenceConstraint

public SimpleReferenceConstraint(StringBuffer representation)
                          throws NonParsableException
Creates a new SimpleReferenceConstraint from its XML-representation.

Parameters:
representation - the XML-representation
Throws:
NonParsableException - is thrown if representation could not be parsed
Method Detail

clone

public SimpleReferenceConstraint clone()
                                throws CloneNotSupportedException
Description copied from interface: Constraint
This method returns a deep copy of the current instance.

Specified by:
clone in interface Constraint
Specified by:
clone in class ReferenceConstraint
Returns:
a deep copy
Throws:
CloneNotSupportedException - if the Constraint could not be cloned
See Also:
Cloneable

check

public boolean check(Object value)
Description copied from interface: Constraint
Checks value for the constraint defined in the Constraint. Is the constraint is fulfilled, true is returned.

Specified by:
check in interface Constraint
Specified by:
check in class ReferenceConstraint
Parameters:
value - the value to be checked
Returns:
if the constraint is fulfilled

toXML

public StringBuffer toXML()
Description copied from interface: Storable
This method returns an XML-representation of an instance of the implementing class.

Specified by:
toXML in interface Storable
Overrides:
toXML in class ReferenceConstraint
Returns:
the XML-representation

fromXML

public void fromXML(StringBuffer representation)
             throws NonParsableException
Description copied from class: ReferenceConstraint
Parses a ReferenceConstraint from the XML-representation as returned by ReferenceConstraint.toXML().

Overrides:
fromXML in class ReferenceConstraint
Parameters:
representation - the XML-representation
Throws:
NonParsableException - thrown if the XML-code could not be parsed