Class NotBlankValidator
- java.lang.Object
-
- org.hibernate.validator.internal.constraintvalidators.bv.NotBlankValidator
-
- All Implemented Interfaces:
ConstraintValidator<NotBlank,CharSequence>
public class NotBlankValidator extends Object implements ConstraintValidator<NotBlank,CharSequence>
Check that a character sequence is notnullnor empty after removing any leading or trailing whitespace.- Author:
- Guillaume Smet
-
-
Constructor Summary
Constructors Constructor Description NotBlankValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisValid(CharSequence charSequence, ConstraintValidatorContext constraintValidatorContext)Checks that the character sequence is notnullnor empty after removing any leading or trailing whitespace.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jakarta.validation.ConstraintValidator
initialize
-
-
-
-
Method Detail
-
isValid
public boolean isValid(CharSequence charSequence, ConstraintValidatorContext constraintValidatorContext)
Checks that the character sequence is notnullnor empty after removing any leading or trailing whitespace.- Specified by:
isValidin interfaceConstraintValidator<NotBlank,CharSequence>- Parameters:
charSequence- the character sequence to validateconstraintValidatorContext- context in which the constraint is evaluated- Returns:
- returns
trueif the string is notnulland the length of the trimmedcharSequenceis strictly superior to 0,falseotherwise
-
-