org.springjutsu.validation.executors
Class ValidWhenEmptyRuleExecutor

java.lang.Object
  extended by org.springjutsu.validation.executors.ValidWhenEmptyRuleExecutor
All Implemented Interfaces:
RuleExecutor
Direct Known Subclasses:
ExactLengthRuleExecutor, MaxLengthRuleExecutor, MinLengthRuleExecutor, RegexMatchRuleExecutor

public abstract class ValidWhenEmptyRuleExecutor
extends Object
implements RuleExecutor

Returns as valid if model object is null or empty, thereby performing an initial null check, and only validating non-empty models.

Author:
Clark Duplichien

Constructor Summary
ValidWhenEmptyRuleExecutor()
           
 
Method Summary
abstract  boolean doValidate(Object model, Object argument)
          Implementors can use this to actually do validation.
 boolean validate(Object model, Object argument)
          Validate the given rule Generally, a rule should return valid if the model is null or empty, unless this is a rule to validate the presence of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidWhenEmptyRuleExecutor

public ValidWhenEmptyRuleExecutor()
Method Detail

validate

public boolean validate(Object model,
                        Object argument)
Description copied from interface: RuleExecutor
Validate the given rule Generally, a rule should return valid if the model is null or empty, unless this is a rule to validate the presence of the object.

Specified by:
validate in interface RuleExecutor
Parameters:
model - The object on which the rule operates
argument - Some argument providing details on how to operate on the object
Returns:
true if valid

doValidate

public abstract boolean doValidate(Object model,
                                   Object argument)
Implementors can use this to actually do validation.

Parameters:
model - Model to validate
argument - Argument to the rule
Returns:
true if the rule passed.


Copyright © 2013 Spring Jutsu. All Rights Reserved.