org.springmodules.validation.util.condition.range
Class BetweenCondition

java.lang.Object
  extended by org.springmodules.validation.util.condition.AbstractCondition
      extended by org.springmodules.validation.util.condition.NonNullAcceptingCondition
          extended by org.springmodules.validation.util.condition.range.AbstractRangeCondition
              extended by org.springmodules.validation.util.condition.range.AbstractBetweenCondition
                  extended by org.springmodules.validation.util.condition.range.BetweenCondition
All Implemented Interfaces:
Condition

public class BetweenCondition
extends AbstractBetweenCondition

An AbstractRangeCondition implementation that checks whether the checked range is between two specific values (excluding).

Author:
Uri Boness

Constructor Summary
BetweenCondition(Comparable lowerBound, Comparable upperBound)
          Constructs a new BetweenCondition with the given bounds (upper and lower) the checked range will be compared with.
BetweenCondition(Object lowerBound, Object upperBound, Comparator comparator)
          Constructs a new BetweenCondition with the given bounds (upper and lower) and the comparator that will be used to compare the checked value.
 
Method Summary
protected  boolean checkRange(Object value, Comparator comparator)
          Checks whether the given value is between the bounds associated with this condition.
 
Methods inherited from class org.springmodules.validation.util.condition.range.AbstractBetweenCondition
getLowerBound, getUpperBound
 
Methods inherited from class org.springmodules.validation.util.condition.range.AbstractRangeCondition
doCheck
 
Methods inherited from class org.springmodules.validation.util.condition.NonNullAcceptingCondition
beforeObjectChecked
 
Methods inherited from class org.springmodules.validation.util.condition.AbstractCondition
afterObjectChecked, and, check, or
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BetweenCondition

public BetweenCondition(Comparable lowerBound,
                        Comparable upperBound)
Constructs a new BetweenCondition with the given bounds (upper and lower) the checked range will be compared with.

Parameters:
lowerBound - The lower bound the checked object will be compared with.
upperBound - The upper bound the checked object will be compared with.

BetweenCondition

public BetweenCondition(Object lowerBound,
                        Object upperBound,
                        Comparator comparator)
Constructs a new BetweenCondition with the given bounds (upper and lower) and the comparator that will be used to compare the checked value.

Parameters:
lowerBound - The lower bound the checked value will be compared with.
upperBound - The upper bound the cheched value will be compared with.
comparator - The comparator that will be used to compared the checked value.
Method Detail

checkRange

protected boolean checkRange(Object value,
                             Comparator comparator)
Checks whether the given value is between the bounds associated with this condition.

Specified by:
checkRange in class AbstractRangeCondition
Parameters:
value - The value to be checked.
comparator - The comparator to be used to compare the checked value.
Returns:
true if the given range is greater than the lower bound and smaller than the upper bound, false otherwise.


Copyright © 2009. All Rights Reserved.