org.hibernate.validator.constraints.impl
Class NotBlankValidator

java.lang.Object
  extended by org.hibernate.validator.constraints.impl.NotBlankValidator
All Implemented Interfaces:
javax.validation.ConstraintValidator<NotBlank,String>

public class NotBlankValidator
extends Object
implements javax.validation.ConstraintValidator<NotBlank,String>

Check that a string's trimmed length is not empty.

Author:
Hardy Ferentschik

Constructor Summary
NotBlankValidator()
           
 
Method Summary
 void initialize(NotBlank annotation)
           
 boolean isValid(String s, javax.validation.ConstraintValidatorContext constraintValidatorContext)
          Checks that the trimmed string is not empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NotBlankValidator

public NotBlankValidator()
Method Detail

initialize

public void initialize(NotBlank annotation)
Specified by:
initialize in interface javax.validation.ConstraintValidator<NotBlank,String>

isValid

public boolean isValid(String s,
                       javax.validation.ConstraintValidatorContext constraintValidatorContext)
Checks that the trimmed string is not empty.

Specified by:
isValid in interface javax.validation.ConstraintValidator<NotBlank,String>
Parameters:
s - The string to validate.
constraintValidatorContext - 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 © 2011 Oracle Corporation. All Rights Reserved.