org.springmodules.validation.valang.predicates
Class AbstractCompareTestPredicate

java.lang.Object
  extended by org.springmodules.validation.valang.predicates.AbstractPropertyPredicate
      extended by org.springmodules.validation.valang.predicates.AbstractCompareTestPredicate
All Implemented Interfaces:
org.apache.commons.collections.Predicate
Direct Known Subclasses:
GreaterThanOrEqualTestPredicate, GreaterThanTestPredicate, LessThanOrEqualTestPredicate, LessThanTestPredicate

public abstract class AbstractCompareTestPredicate
extends AbstractPropertyPredicate

Base class for comparing less than and greater than comparisons.

Author:
David Winterfeldt

Constructor Summary
AbstractCompareTestPredicate(Function leftFunction, Operator operator, Function rightFunction, int line, int column, String operatorSymbol)
          Constructor taking two functions and an operator.
 
Method Summary
protected abstract  boolean doEvaluate(BigDecimal leftValue, BigDecimal rightValue)
          Evaluates a BigDecimal and is called by evaluate.
protected abstract  boolean doEvaluate(Date leftValue, Date rightValue)
          Evaluates a Date and is called by evaluate.
 boolean evaluate(Object target)
          The evaluate method takes the result of both functions and tests with the operator.
 
Methods inherited from class org.springmodules.validation.valang.predicates.AbstractPropertyPredicate
getArray, getColumn, getIterator, getLeftFunction, getLine, getOperator, getRightFunction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCompareTestPredicate

public AbstractCompareTestPredicate(Function leftFunction,
                                    Operator operator,
                                    Function rightFunction,
                                    int line,
                                    int column,
                                    String operatorSymbol)

Constructor taking two functions and an operator.

Parameters:
leftFunction - the left function
operator - the operator.
Method Detail

evaluate

public final boolean evaluate(Object target)

The evaluate method takes the result of both functions and tests with the operator.

Specified by:
evaluate in interface org.apache.commons.collections.Predicate
Specified by:
evaluate in class AbstractPropertyPredicate
Parameters:
target - The target bean.
Returns:
boolean Whether or not the test passed.

doEvaluate

protected abstract boolean doEvaluate(BigDecimal leftValue,
                                      BigDecimal rightValue)
Evaluates a BigDecimal and is called by evaluate.


doEvaluate

protected abstract boolean doEvaluate(Date leftValue,
                                      Date rightValue)
Evaluates a Date and is called by evaluate.



Copyright © 2009. All Rights Reserved.