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

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
All Implemented Interfaces:
Condition
Direct Known Subclasses:
AbstractCollectionElementCondition, IsEmptyCollectionCondition, MaxSizeCollectionCondition, MinSizeCollectionCondition, SizeRangeCollectionCondition

public abstract class AbstractCollectionCondition
extends NonNullAcceptingCondition

A base class for all collection conditions.

Author:
Uri Boness

Constructor Summary
AbstractCollectionCondition()
           
 
Method Summary
protected  void beforeObjectChecked(Object object)
          See NonNullAcceptingCondition.beforeObjectChecked(Object).
protected abstract  boolean checkArray(Object array)
          Checks whether the given array adheres to this Condition.
protected abstract  boolean checkCollection(Collection collection)
          Checks whether the given collection adheres to this Condition.
 boolean doCheck(Object object)
          See AbstractCondition.doCheck(Object).
 
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

AbstractCollectionCondition

public AbstractCollectionCondition()
Method Detail

beforeObjectChecked

protected void beforeObjectChecked(Object object)
See NonNullAcceptingCondition.beforeObjectChecked(Object).

Also verifies the given object is of a Collection or an array.

Overrides:
beforeObjectChecked in class NonNullAcceptingCondition
Parameters:
object - The checked object.

doCheck

public final boolean doCheck(Object object)
See AbstractCondition.doCheck(Object).

If the given object is an array, the call is delegated to checkArray(Object).

If the given object is of a Collection type, the call is delegated to checkCollection(java.util.Collection).

Specified by:
doCheck in class AbstractCondition
Parameters:
object - The object to be checked.
Returns:
true if the given object adheres to this condition, false otherwise.

checkArray

protected abstract boolean checkArray(Object array)
Checks whether the given array adheres to this Condition.

Parameters:
array - The array to be checked.
Returns:
true if the given array adheres to this condition, false otherwise.

checkCollection

protected abstract boolean checkCollection(Collection collection)
Checks whether the given collection adheres to this Condition.

Parameters:
collection - The collection to be checked.
Returns:
true if the given collection adheres to this condition, false otherwise.


Copyright © 2009. All Rights Reserved.