org.enhydra.barracuda.core.forms
Class Not

java.lang.Object
  |
  +--org.enhydra.barracuda.core.forms.AbstractFormValidator
        |
        +--org.enhydra.barracuda.core.forms.Not
All Implemented Interfaces:
FormValidator

public class Not
extends AbstractFormValidator

This validator ensures that something is NOT valid. We do this by validating another validator; if it does NOT generate a ValidationException then we throw an exception because it should have. If it does throw a ValidationException, then all is well. This validator effectively acts as a "NOT" or "!" on another FormValidator.

Since:
1.0
Version:
%I%, %G%
Author:
Christian Cryder
, Bill Wallace , Diez B. Roggisch , Jacob Kjome

Field Summary
protected  FormValidator fv
           
 
Fields inherited from class org.enhydra.barracuda.core.forms.AbstractFormValidator
localLogger
 
Constructor Summary
Not(FormValidator ifv)
          Public constructor.
Not(FormValidator ifv, java.lang.String ierrmsg)
          Public constructor.
 
Method Summary
 FormValidator getSubValidator()
          Return the value that is being not'ed
 void validate(FormElement element, FormMap map, boolean deferExceptions)
          Rather than calling all the sub validate methods, we instead validate the validator we contain--because this validator is effectively doing a "NOT", we expect to receive a ValidationException; if we dont, then we will throw a ValidationException
 
Methods inherited from class org.enhydra.barracuda.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

fv

protected FormValidator fv
Constructor Detail

Not

public Not(FormValidator ifv)
Public constructor.


Not

public Not(FormValidator ifv,
           java.lang.String ierrmsg)
Public constructor.

Method Detail

getSubValidator

public FormValidator getSubValidator()
Return the value that is being not'ed

Returns:
The form element to negate

validate

public void validate(FormElement element,
                     FormMap map,
                     boolean deferExceptions)
              throws ValidationException
Rather than calling all the sub validate methods, we instead validate the validator we contain--because this validator is effectively doing a "NOT", we expect to receive a ValidationException; if we dont, then we will throw a ValidationException

Parameters:
element - the form element to be validated (null indicates we want to perform form level validation)
map - the map to which the element belongs (sometimes necessary 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 © 2001 Enhydra.org