org.apache.bval.constraints
Class SizeValidatorForCollection

java.lang.Object
  extended by org.apache.bval.constraints.SizeValidator
      extended by org.apache.bval.constraints.SizeValidatorForCollection
All Implemented Interfaces:
ConstraintValidator<Size,Collection<?>>

public class SizeValidatorForCollection
extends SizeValidator
implements ConstraintValidator<Size,Collection<?>>

Check that a Collection's size is between min and max.


Field Summary
 
Fields inherited from class org.apache.bval.constraints.SizeValidator
max, min
 
Constructor Summary
SizeValidatorForCollection()
           
 
Method Summary
 boolean isValid(Collection<?> collection, ConstraintValidatorContext context)
          Checks the number of entries in a map.
 
Methods inherited from class org.apache.bval.constraints.SizeValidator
initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.validation.ConstraintValidator
initialize
 

Constructor Detail

SizeValidatorForCollection

public SizeValidatorForCollection()
Method Detail

isValid

public boolean isValid(Collection<?> collection,
                       ConstraintValidatorContext context)
Checks the number of entries in a map.

Specified by:
isValid in interface ConstraintValidator<Size,Collection<?>>
Parameters:
collection - The collection to validate.
context - context in which the constraint is evaluated.
Returns:
Returns true if the collection is null or the number of entries in collection is between the specified min and max values (inclusive), false otherwise.


Copyright © 2010-2012 Apache Software Foundation. All Rights Reserved.