org.apache.bval.constraints
Class SizeValidatorForString

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

public class SizeValidatorForString
extends SizeValidator
implements ConstraintValidator<Size,String>

Check that a string's length is between min and max.


Field Summary
 
Fields inherited from class org.apache.bval.constraints.SizeValidator
max, min
 
Constructor Summary
SizeValidatorForString()
           
 
Method Summary
 boolean isValid(String s, ConstraintValidatorContext context)
          Checks the length of the specified string.
 
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

SizeValidatorForString

public SizeValidatorForString()
Method Detail

isValid

public boolean isValid(String s,
                       ConstraintValidatorContext context)
Checks the length of the specified string.

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


Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.