org.formaria.pojo.commons
Class CommonsValidator

java.lang.Object
  extended by org.formaria.aria.validation.AbstractValidator
      extended by org.formaria.pojo.commons.CommonsValidator
All Implemented Interfaces:
Validator

public class CommonsValidator
extends AbstractValidator

A validator that delegates to the Apache Commons library

Copyright (c) Formaria Ltd., 2008

License: see license.txt


Field Summary
static java.lang.String ERRORS_KEY
          Key used to store the Spring Errors instance in the Validator
 
Fields inherited from class org.formaria.aria.validation.AbstractValidator
container, currentProject, errorLevel, formattedMessage, mandatory, mask, message, showErrorBadges, start, translator, USE_FAIL_STYLE, USE_NORMAL_STYLE, USE_WARN_STYLE, validationMethod, validationName, value
 
Fields inherited from interface org.formaria.aria.validation.Validator
IGNORE_BLANKS, LEVEL_ERROR, LEVEL_IGNORE, LEVEL_WARNING, MANDATORY, STRICT_CHECK, WEAK_CHECK
 
Constructor Summary
CommonsValidator(Project project)
          Applied to components when input is simply mandatory
 
Method Summary
 void setup(XmlElement ruleConfig, XmlElement instanceConfig)
          Set the validation parameters
 void validate(java.lang.Object c, boolean forceMandatory)
          Carries out the mandatory validation on the component.
 
Methods inherited from class org.formaria.aria.validation.AbstractValidator
applyErrorStyle, getLevel, getMask, getMessage, getName, getText, getValueAsString, invokeMethod, replaceToken, replaceTokens, setMask, setName, setValidationColors, setValidationMethod, throwException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERRORS_KEY

public static final java.lang.String ERRORS_KEY
Key used to store the Spring Errors instance in the Validator

See Also:
Constant Field Values
Constructor Detail

CommonsValidator

public CommonsValidator(Project project)
Applied to components when input is simply mandatory

Parameters:
project - the owner project
Method Detail

setup

public void setup(XmlElement ruleConfig,
                  XmlElement instanceConfig)
Set the validation parameters

Specified by:
setup in interface Validator
Overrides:
setup in class AbstractValidator
Parameters:
ruleConfig - the validator parameters as declared in the validations rules file
instanceConfig - the validator instance parameters as declared in the page file

validate

public void validate(java.lang.Object c,
                     boolean forceMandatory)
              throws java.lang.Exception
Carries out the mandatory validation on the component. If the Method validationMethod is not null we have to invoke it in order to get it's return value. If a problem is found we format the message using the messageHelper.

Parameters:
forceMandatory - true when inline validations are carried out
c - The component triggering the validation
Throws:
java.lang.Exception - Contains the details of the message