org.araneaframework.uilib.form
Interface Constraint

All Superinterfaces:
Serializable
All Known Implementing Classes:
BaseConstraint

public interface Constraint
extends Serializable

A constraint operates on some form Component providing means for defining the conditions under which Component is considered valid. During validation, Constraint may produce appropriate error messages.

See Also:
BaseConstraint

Method Summary
 void clearErrors()
          Clears the the errors produced while validating this Constraint.
 Set getErrors()
          Returns the validation errors produced while validating this Constraint.
 void setCustomErrorMessage(String customErrorMessage)
          Sets the custom error message, that will be used in place of default ones when this Constraint does not hold.
 void setEnvironment(Environment environment)
          Sets the Environment of this Constraint.
 boolean validate()
          This method validates this Constraint conditions.
 

Method Detail

validate

public boolean validate()
                 throws Exception
This method validates this Constraint conditions.

Throws:
Exception

getErrors

public Set getErrors()
Returns the validation errors produced while validating this Constraint.

Returns:
validation errors.

clearErrors

public void clearErrors()
Clears the the errors produced while validating this Constraint.


setCustomErrorMessage

public void setCustomErrorMessage(String customErrorMessage)
Sets the custom error message, that will be used in place of default ones when this Constraint does not hold.

Parameters:
customErrorMessage - custom error message

setEnvironment

public void setEnvironment(Environment environment)
Sets the Environment of this Constraint. Environment should come from whatever Component that this Constraint is operating on.

The Environment of a Constraint may be set to non-null value only once, further calls are ignored. Application programmer typically never calls this method as Environment is propagated seamlessly.

Parameters:
environment - the Environment for this constraint.