org.barracudamvc.core.forms
Class Not
java.lang.Object
org.barracudamvc.core.forms.AbstractFormValidator
org.barracudamvc.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 [christianc@granitepeaks.com], Bill Wallace , Diez B. Roggisch , Jacob Kjome
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fv
protected FormValidator fv
Not
public Not(FormValidator ifv)
- Public constructor.
- Parameters:
ifv
- the validator we wish to make sure is not valid
Not
public Not(FormValidator ifv,
String ierrmsg)
- Public constructor.
- Parameters:
ifv
- the validator we wish to make sure is not validierrmsg
- the message associated with this error
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 © 2006 BarracudaMVC.org All Rights Reserved.