org.springmodules.validation.valang.predicates
Class BasicValidationRule

java.lang.Object
  extended by org.springmodules.validation.valang.predicates.BasicValidationRule
All Implemented Interfaces:
ValidationRule

public class BasicValidationRule
extends Object
implements ValidationRule

Validation rule implementation that will validate a target bean an return an error message is the validation fails.

Since:
23-04-2005
Author:
Steven Devijver

Constructor Summary
BasicValidationRule(String defaultPropertyName, org.apache.commons.collections.Predicate predicate, org.apache.commons.collections.Predicate wherePredicate, String errorKey, String errorMessage, Collection<Function> errorArgs)
          Constructor.
BasicValidationRule(String defaultPropertyName, org.apache.commons.collections.Predicate predicate, String errorMessage)
          Constructor.
 
Method Summary
 Collection<Function> getErrorArgs()
          Get error args.
 String getErrorKey()
          Gets error key.
 String getErrorMessage()
          Gets error message.
 String getField()
          Gets field.
 org.apache.commons.collections.Predicate getPredicate()
          Gets predicate.
 void validate(Object target, Errors errors)
          Validates bean and records any errors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicValidationRule

public BasicValidationRule(String defaultPropertyName,
                           org.apache.commons.collections.Predicate predicate,
                           String errorMessage)
Constructor.

Parameters:
field - Default property/field name.
predicate - Predicate used for comparison.
errorMessage - Default error message.

BasicValidationRule

public BasicValidationRule(String defaultPropertyName,
                           org.apache.commons.collections.Predicate predicate,
                           org.apache.commons.collections.Predicate wherePredicate,
                           String errorKey,
                           String errorMessage,
                           Collection<Function> errorArgs)
Constructor.

Parameters:
field - Default property/field name.
predicate - Predicate used for comparison.
wherePredicate - Where predicate used for whether or not validation should be performed.
errorKey - Message resource key for the error.
errorMessage - Default error message.
errorArgs - Error message argument.
Method Detail

getPredicate

public org.apache.commons.collections.Predicate getPredicate()
Gets predicate.


getErrorMessage

public String getErrorMessage()
Gets error message.


getField

public String getField()
Gets field.


getErrorKey

public String getErrorKey()
Gets error key.


getErrorArgs

public Collection<Function> getErrorArgs()
Get error args.


validate

public void validate(Object target,
                     Errors errors)
Validates bean and records any errors.

Specified by:
validate in interface ValidationRule


Copyright © 2009. All Rights Reserved.