org.springmodules.validation.util.condition.collection
Class SizeRangeCollectionCondition

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.collection.AbstractCollectionCondition
              extended by org.springmodules.validation.util.condition.collection.SizeRangeCollectionCondition
All Implemented Interfaces:
Condition

public class SizeRangeCollectionCondition
extends AbstractCollectionCondition

An AbstractCollectionCondition that checks that the size/length of the the checked collection/array is with in a specific bounds.

Author:
Uri Boness

Constructor Summary
SizeRangeCollectionCondition(int minSize, int maxSize)
          Constructs a new SizeRangeCollectionCondition with a given minimum and maximum sizes.
 
Method Summary
protected  boolean checkArray(java.lang.Object array)
          Checks whether the given array is in the boundries of the range defined by this condition.
protected  boolean checkCollection(java.util.Collection collection)
          Checks whether the given collection is in the boundries of the range defined by this condition.
 int getMaxSize()
          Returns the maximum size of this range condition
 int getMinSize()
          Returns the minimum size of this range condition
 
Methods inherited from class org.springmodules.validation.util.condition.collection.AbstractCollectionCondition
beforeObjectChecked, doCheck
 
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

SizeRangeCollectionCondition

public SizeRangeCollectionCondition(int minSize,
                                    int maxSize)
Constructs a new SizeRangeCollectionCondition with a given minimum and maximum sizes.

Parameters:
minSize - The given minimum size.
maxSize - The given maximum size.
Method Detail

checkArray

protected boolean checkArray(java.lang.Object array)
Checks whether the given array is in the boundries of the range defined by this condition.

Specified by:
checkArray in class AbstractCollectionCondition
Parameters:
array - The array to be checked.
Returns:
true if the given array adheres to this condition, false otherwise.
See Also:
AbstractCollectionCondition.checkArray(Object)

checkCollection

protected boolean checkCollection(java.util.Collection collection)
Checks whether the given collection is in the boundries of the range defined by this condition.

Specified by:
checkCollection in class AbstractCollectionCondition
Parameters:
collection - The collection to be checked.
Returns:
true if the given collection adheres to this condition, false otherwise.
See Also:
AbstractCollectionCondition.checkCollection(java.util.Collection)

getMinSize

public int getMinSize()
Returns the minimum size of this range condition

Returns:
The minimum size of this range condition

getMaxSize

public int getMaxSize()
Returns the maximum size of this range condition

Returns:
The maximum size of this range condition


Copyright © 2005. All Rights Reserved.