org.springframework.rules.constraint
Class Range

java.lang.Object
  extended by org.springframework.core.closure.support.AlgorithmsAccessor
      extended by org.springframework.rules.constraint.ConstraintsAccessor
          extended by org.springframework.rules.constraint.AbstractConstraint
              extended by org.springframework.rules.constraint.Range
All Implemented Interfaces:
Serializable, Constraint

public final class Range
extends AbstractConstraint

A range whose edges are defined by a minimum Comparable and a maximum Comparable.

Author:
Keith Donald
See Also:
Serialized Form

Constructor Summary
Range(Comparable min, Comparable max)
          Creates a range with the specified Comparable min and max edges.
Range(Comparable min, Comparable max, boolean inclusive)
          Creates a range with the specified Comparable min and max edges.
Range(double min, double max)
          Convenience constructor for double ranges.
Range(double min, double max, boolean inclusive)
          Convenience constructor for double ranges.
Range(float min, float max)
          Convenience constructor for float ranges.
Range(float min, float max, boolean inclusive)
          Convenience constructor for float ranges.
Range(int min, int max)
          Convenience constructor for int ranges.
Range(int min, int max, boolean inclusive)
          Convenience constructor for int ranges.
Range(Object min, Object max, Comparator comparator)
          Creates a range with the specified min and max edges.
Range(Object min, Object max, Comparator comparator, boolean inclusive)
          Creates a range with the specified min and max edges.
 
Method Summary
 Object getMax()
           
 Object getMin()
           
 boolean isInclusive()
           
 boolean test(Object argument)
          Test if the specified argument falls within the established range.
 String toString()
           
 
Methods inherited from class org.springframework.rules.constraint.AbstractConstraint
allTrue, allTrue, anyTrue, anyTrue, findAll, findAll, findFirst, findFirst
 
Methods inherited from class org.springframework.rules.constraint.ConstraintsAccessor
all, all, and, any, any, bind, bind, bind, bind, bind, conjunction, disjunction, eq, eq, eq, eq, eq, eqProperty, eqProperty, getConstraints, gt, gt, gt, gt, gt, gt, gt, gte, gte, gte, gte, gte, gte, gte, gteProperty, gteProperty, gtProperty, gtProperty, ifTrue, ifTrueElse, inGroup, inGroup, inGroup, inRange, inRange, inRangeProperties, inRangeProperties, like, like, lt, lt, lt, lt, lt, lt, lt, lte, lte, lte, lte, lte, lte, lte, lteProperty, lteProperty, ltProperty, ltProperty, maxLength, method, minLength, not, not, or, present, present, range, range, range, range, range, range, range, regexp, regexp, required, required, testResultOf, unique, value
 
Methods inherited from class org.springframework.core.closure.support.AlgorithmsAccessor
allTrue, allTrue, anyTrue, anyTrue, findAll, findAll, findFirst, findFirst, forEach, forEach, getAlgorithms
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Range

public Range(Comparable min,
             Comparable max)
Creates a range with the specified Comparable min and max edges.

Parameters:
min - the low edge of the range
max - the high edge of the range

Range

public Range(Comparable min,
             Comparable max,
             boolean inclusive)
Creates a range with the specified Comparable min and max edges.

Parameters:
min - the low edge of the range
max - the high edge of the range
inclusive - the range is inclusive?

Range

public Range(Object min,
             Object max,
             Comparator comparator)
Creates a range with the specified min and max edges.

Parameters:
min - the low edge of the range
max - the high edge of the range
comparator - the comparator to use to perform value comparisons

Range

public Range(Object min,
             Object max,
             Comparator comparator,
             boolean inclusive)
Creates a range with the specified min and max edges.

Parameters:
min - the low edge of the range
max - the high edge of the range
comparator - the comparator to use to perform value comparisons

Range

public Range(int min,
             int max)
Convenience constructor for int ranges.


Range

public Range(int min,
             int max,
             boolean inclusive)
Convenience constructor for int ranges.


Range

public Range(float min,
             float max)
Convenience constructor for float ranges.


Range

public Range(float min,
             float max,
             boolean inclusive)
Convenience constructor for float ranges.


Range

public Range(double min,
             double max)
Convenience constructor for double ranges.


Range

public Range(double min,
             double max,
             boolean inclusive)
Convenience constructor for double ranges.

Method Detail

getMin

public Object getMin()

getMax

public Object getMax()

isInclusive

public boolean isInclusive()

test

public boolean test(Object argument)
Test if the specified argument falls within the established range.

Parameters:
argument - the argument value
Returns:
true if the condition was satisfied, false otherwise
See Also:
Constraint.test(java.lang.Object)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.