Interface FieldValidator

All Superinterfaces:

public interface FieldValidator

Defines the interface for classes that will play the role of value validators for org.jscience.sociology.forms.TextBox and org.jscience.sociology.forms.PasswordBox fields. The criteria of validation will be implemented through getErrorMessage() method of this interface. A class of type TextBox will register one or more FieldValidator objects via addFieldValidator() method.

The following shows how to add a FieldValidator to a field in forms.xml:

 <field name="field name"
      FieldValidator object name

A FieldValidator object will normally be shared by all client threads of one or even more forms, therefore the implementation has to take care of possible synchronization issues.

See Also:
TextBox, PasswordBox

Method Summary
 java.lang.String getErrorMessage(java.lang.String value)
          Gets the error message resulting from the validation.

Method Detail


java.lang.String getErrorMessage(java.lang.String value)
Gets the error message resulting from the validation. If the supplied value passes the test (or tests) implemented by this method, an empty string must be returned.

value - the value to be tested.
the error message or an empty string in case the value has successfully passed the test.