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

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.MinSizeCollectionCondition
All Implemented Interfaces:
Condition

public class MinSizeCollectionCondition
extends AbstractCollectionCondition

An AbstractCollectionCondition implementation that checks whether the given collection or array is longer then a specific minimum size.

Author:
Uri Boness

Constructor Summary
MinSizeCollectionCondition(int minSize)
          Constructs a new MinSizeCollectionCondition with a given minimum size.
 
Method Summary
protected  boolean checkArray(java.lang.Object array)
          Checks whether the length of the given array is greater than or equals the minimum size associated with this condition.
protected  boolean checkCollection(java.util.Collection collection)
          Checks whether the size of the given collection is greater than or equals the minimum size associated with this condition.
 int getMinSize()
          Returns the minimum size associated with this 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

MinSizeCollectionCondition

public MinSizeCollectionCondition(int minSize)
Constructs a new MinSizeCollectionCondition with a given minimum size.

Parameters:
minSize - The minimum size.
Method Detail

checkArray

protected boolean checkArray(java.lang.Object array)
Checks whether the length of the given array is greater than or equals the minimum size associated with this condition.

Specified by:
checkArray in class AbstractCollectionCondition
Parameters:
array - The array to be checked.
Returns:
true if the length of the given array is greater than or equals the minimum size associated with this condition, false otherwise.

checkCollection

protected boolean checkCollection(java.util.Collection collection)
Checks whether the size of the given collection is greater than or equals the minimum size associated with this condition.

Specified by:
checkCollection in class AbstractCollectionCondition
Parameters:
collection - The collection to be checked.
Returns:
true if the size of the given collection is greater than or equals the minimum size associated with this condition, false otherwise.

getMinSize

public int getMinSize()
Returns the minimum size associated with this condition.

Returns:
The minimum size associated with this condition.


Copyright © 2005. All Rights Reserved.