org.enhydra.barracuda.core.forms
Class AbstractFormValidator
java.lang.Object
|
+--org.enhydra.barracuda.core.forms.AbstractFormValidator
- All Implemented Interfaces:
- FormValidator
- Direct Known Subclasses:
- And, DefaultFormValidator, ListValidator, Not, Or
- public abstract class AbstractFormValidator
- extends java.lang.Object
- implements FormValidator
The root implementation of the FormValidator interface
Field Summary |
protected static org.apache.log4j.Logger |
localLogger
|
Method Summary |
ValidationException |
generateException(java.lang.Object source,
boolean deferExceptions,
java.lang.String defaultMsg)
This is a simple convenience method to return the appropriate type
of exception based on whether we're deferring or not. |
java.lang.String |
getErrorMessage()
Get the error message to be used in the event of an error. |
boolean |
isNull(java.lang.Object val,
FormElement element)
Check if val passed is null in a consistant manner.
|
void |
setErrorMessage(java.lang.String ierrmsg)
Set the error message to be used in the event of an error. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
localLogger
protected static org.apache.log4j.Logger localLogger
AbstractFormValidator
public AbstractFormValidator()
setErrorMessage
public void setErrorMessage(java.lang.String ierrmsg)
- Set the error message to be used in the event of an error.
- Specified by:
setErrorMessage
in interface FormValidator
getErrorMessage
public java.lang.String getErrorMessage()
- Get the error message to be used in the event of an error.
- Specified by:
getErrorMessage
in interface FormValidator
- Returns:
- the error message to be used in the event
of an error
generateException
public ValidationException generateException(java.lang.Object source,
boolean deferExceptions,
java.lang.String defaultMsg)
- This is a simple convenience method to return the appropriate type
of exception based on whether we're deferring or not.
- Parameters:
source
- the source of the exceptiondeferExceptions
- true if we want to generate a DeferredValidationExceptiondefaultMsg
- the error message to use if no error message specified in
the constructor of the validator
- Returns:
- a validation exception
isNull
public boolean isNull(java.lang.Object val,
FormElement element)
- Check if val passed is null in a consistant manner.
Most validators should call isNull(val) first thing
and return if that is the case. Leave null validation
up to NotNullValidator.
- Specified by:
isNull
in interface FormValidator
- Parameters:
val
- the value to test for nullness
Copyright © 2001 Enhydra.org