org.iscreen
Interface ValidatorContext

All Known Subinterfaces:
InternalValidatorContext
All Known Implementing Classes:
DefaultValidatorContext

public interface ValidatorContext

During validation, a Validator is given a reference to the context in which it is validating. The primary purpose of this context is to provide a means for the Validator to report validation failures. In the future, additional APIs will be added to support additional contextual information for use by the Validator.

Author:
Shellman, Dan

Method Summary
 java.util.Locale getLocale()
          Gets the current locale being used for this validation.
 ValidationService getValidationService()
          Retrieves the validation service this context is being used with.
 java.lang.String getValidatorName()
          Obtains the name of the validator currently being used
 void reportFailure(FailureMessage messageObject)
          Called to report a validation failure.
 void reportFailure(FailureMessage messageObject, java.lang.Object failureObject)
          Called to report a validation failure.
 

Method Detail

reportFailure

void reportFailure(FailureMessage messageObject)
Called to report a validation failure. The Object provided is the failure message (usually configured as a setter on the individual Validator).

Parameters:
messageObject - The message failure object representing the failure.

reportFailure

void reportFailure(FailureMessage messageObject,
                   java.lang.Object failureObject)
Called to report a validation failure. The Object provided is the failure message (usually configured as a setter on the individual Validator). The additional failure object is used to help generate the actual failure message (it becomes accessible to the message via the OGNL root).

Parameters:
messageObject - The message failure object representing the failure.
failureObject - A Validator-specific failure object to be made accessible to the message via the OGNL root.

getLocale

java.util.Locale getLocale()
Gets the current locale being used for this validation.

Returns:
Returns the current locale being used.

getValidationService

ValidationService getValidationService()
Retrieves the validation service this context is being used with.

Returns:
Returns the validation service (validation set) that is being used.

getValidatorName

java.lang.String getValidatorName()
Obtains the name of the validator currently being used

Returns:
The name of the validator.