org.formproc.validation
Class ValidationResult

java.lang.Object
  |
  +--org.formproc.validation.ValidationResult

public class ValidationResult
extends java.lang.Object

Class which represents a form validation results.

Author:
Anthony Eden

Field Summary
protected  java.lang.Throwable error
           
protected  FormData[] formData
           
protected  FormElement[] formElements
           
protected  java.util.Locale locale
           
protected  boolean valid
           
protected  Validator validator
           
 
Constructor Summary
  ValidationResult(FormElement[] formElements, FormData[] formData, java.util.Locale locale)
          Construct a new ValidationResult object.
  ValidationResult(FormElement[] formElements, FormData[] formData, java.util.Locale locale, Validator validator)
          Construct a new ValidationResult object.
protected ValidationResult(FormElement[] formElements, FormData[] formData, java.util.Locale locale, Validator validator, boolean valid, java.lang.Throwable error)
          Construct a ValidationResult object.
  ValidationResult(FormElement[] formElements, FormData[] formData, java.util.Locale locale, Validator validator, java.lang.Throwable error)
          Construct a new ValidationResult object.
 
Method Summary
 java.lang.Throwable getError()
          Return the Throwable error or null.
 java.lang.String getErrorMessage()
          Return the error message from the validator which was in error using the default Locale.
 java.lang.String getErrorMessage(java.util.Locale locale)
          Return the error message from the validator which was in error using the given Locale.
 FormData[] getFormData()
          Get the validated FormData array.
 FormElement[] getFormElements()
          Get the array of validated elements.
 java.util.Locale getLocale()
          Get the Locale which was specified at validation time.
 Validator getValidator()
          Return the validator which is in error.
 boolean isValid()
          Return true all fields are valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

formElements

protected FormElement[] formElements

formData

protected FormData[] formData

locale

protected java.util.Locale locale

validator

protected Validator validator

valid

protected boolean valid

error

protected java.lang.Throwable error
Constructor Detail

ValidationResult

public ValidationResult(FormElement[] formElements,
                        FormData[] formData,
                        java.util.Locale locale)
Construct a new ValidationResult object. This constructor will set the valid flag to true.

Parameters:
formElements - The FormElements which were validated
formData - The FormData array
locale - The Locale used at the time of validation

ValidationResult

public ValidationResult(FormElement[] formElements,
                        FormData[] formData,
                        java.util.Locale locale,
                        Validator validator)
Construct a new ValidationResult object. This constructor will set the valid flag to false.

Parameters:
formElements - The FormElements which were validated
formData - The FormData array
locale - The Locale used at the time of validation
validator - The validator which caused the error

ValidationResult

public ValidationResult(FormElement[] formElements,
                        FormData[] formData,
                        java.util.Locale locale,
                        Validator validator,
                        java.lang.Throwable error)
Construct a new ValidationResult object. This constructor will set the valid flag to false.

Parameters:
formElements - The FormElements which were validated
formData - The FormData array
locale - The Locale used at the time of validation
validator - The validator which caused the error
error - The Throwable

ValidationResult

protected ValidationResult(FormElement[] formElements,
                           FormData[] formData,
                           java.util.Locale locale,
                           Validator validator,
                           boolean valid,
                           java.lang.Throwable error)
Construct a ValidationResult object.

Parameters:
formElements - The FormElements which were validated
formData - The FormData array
locale - The Locale used at the time of validation
validator - The Validator which caused the error (or null)
valid - True if the field was valid
error - The error object (or null)
Method Detail

isValid

public boolean isValid()
Return true all fields are valid.

Returns:
True if the field is valid

getErrorMessage

public java.lang.String getErrorMessage()
Return the error message from the validator which was in error using the default Locale.

Returns:
The error message

getErrorMessage

public java.lang.String getErrorMessage(java.util.Locale locale)
Return the error message from the validator which was in error using the given Locale.

Parameters:
locale - The Locale
Returns:
The error message

getFormElements

public FormElement[] getFormElements()
Get the array of validated elements.

Returns:
The array of formElements

getFormData

public FormData[] getFormData()
Get the validated FormData array.

Returns:
The FormData array

getLocale

public java.util.Locale getLocale()
Get the Locale which was specified at validation time.

Returns:
The Locale

getError

public java.lang.Throwable getError()
Return the Throwable error or null.

Returns:
The Throwable error

getValidator

public Validator getValidator()
Return the validator which is in error. This method must return null if the validation was successful.

Returns:
The validator in error or null


Copyright (c) 2001-2003 Anthony Eden. All Rights Reserved.