org.hibernate.validator.constraints.impl
Class SizeValidatorForArray

java.lang.Object
  extended by org.hibernate.validator.constraints.impl.SizeValidatorForArray
All Implemented Interfaces:
ConstraintValidator<Size,Object[]>

public class SizeValidatorForArray
extends Object
implements ConstraintValidator<Size,Object[]>

Check that the length of an array is between min and max

Author:
Hardy Ferentschik

Constructor Summary
SizeValidatorForArray()
           
 
Method Summary
 void initialize(Size parameters)
           
 boolean isValid(Object[] array, ConstraintValidatorContext constraintValidatorContext)
          Checks the number of entries in an array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SizeValidatorForArray

public SizeValidatorForArray()
Method Detail

initialize

public void initialize(Size parameters)
Specified by:
initialize in interface ConstraintValidator<Size,Object[]>

isValid

public boolean isValid(Object[] array,
                       ConstraintValidatorContext constraintValidatorContext)
Checks the number of entries in an array.

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


Copyright © 2007-2011 Red Hat Middleware, LLC. All Rights Reserved