org.barracudamvc.core.forms.validators
Class EqualsValidator

java.lang.Object
  extended by org.barracudamvc.core.forms.AbstractFormValidator
      extended by org.barracudamvc.core.forms.DefaultFormValidator
          extended by org.barracudamvc.core.forms.validators.EqualsValidator
All Implemented Interfaces:
FormValidator

public class EqualsValidator
extends DefaultFormValidator

This validator ensures that the original value constitues a valid type


Field Summary
protected  Object obj
           
 
Fields inherited from class org.barracudamvc.core.forms.DefaultFormValidator
localLogger, validators
 
Constructor Summary
EqualsValidator()
          Public no-args constructor.
EqualsValidator(Object iobj)
          Public constructor.
EqualsValidator(Object iobj, String ierrmsg)
          Public constructor.
 
Method Summary
 Object getObject()
          Return the value that this object must equal.
 void validateFormElement(Object val, FormElement element, boolean deferExceptions)
          Validate a FormElement to make see if the element equals() a given object
 
Methods inherited from class org.barracudamvc.core.forms.DefaultFormValidator
addValidator, getValidators, removeValidator, validate, validateForm, validateFormElement
 
Methods inherited from class org.barracudamvc.core.forms.AbstractFormValidator
generateException, getErrorMessage, isNull, setErrorMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

obj

protected Object obj
Constructor Detail

EqualsValidator

public EqualsValidator()
Public no-args constructor.


EqualsValidator

public EqualsValidator(Object iobj)
Public constructor.

Parameters:
iobj - the object with which we wish to compare equality

EqualsValidator

public EqualsValidator(Object iobj,
                       String ierrmsg)
Public constructor.

Parameters:
iobj - the object with which we wish to compare equality
ierrmsg - the message associated with this error
Method Detail

getObject

public Object getObject()
Return the value that this object must equal.


validateFormElement

public void validateFormElement(Object val,
                                FormElement element,
                                boolean deferExceptions)
                         throws ValidationException
Validate a FormElement to make see if the element equals() a given object

Overrides:
validateFormElement in class DefaultFormValidator
Parameters:
val - the value to compare the element value to
element - the form element that contains the val to validate elements by comparing them with other elements)
deferExceptions - do we want to deferValidation exceptions and attempt to validate all elements so that we can process all the exceptions at once
Throws:
ValidationException - if the element is not valid


Copyright © 2006 BarracudaMVC.org All Rights Reserved.