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

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

public class MaxSizeCollectionCondition
extends AbstractCollectionCondition

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

Author:
Uri Boness

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

MaxSizeCollectionCondition

public MaxSizeCollectionCondition(int maxSize)
Constructs a new MaxSizeCollectionCondition with a given maximum size.

Parameters:
maxSize - The maximum size.
Method Detail

checkArray

protected boolean checkArray(java.lang.Object array)
Checks whether the length of the given array is smaller than or equals the maximum 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 smaller than or equals the maximum size associated with this condition, false otherwise.

checkCollection

protected boolean checkCollection(java.util.Collection collection)
Checks whether the size of the given collection is smaller than or equals the maximum 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 smaller than or equals the maximum size associated with this condition, false otherwise.

getMaxSize

public int getMaxSize()
Returns the maximum size associated with this condition.

Returns:
The maximum size associated with this condition.


Copyright © 2005. All Rights Reserved.