java.lang.Object
org.hibernate.validator.internal.constraintvalidators.bv.NotBlankValidator
All Implemented Interfaces:
jakarta.validation.ConstraintValidator<jakarta.validation.constraints.NotBlank,CharSequence>

public class NotBlankValidator extends Object implements jakarta.validation.ConstraintValidator<jakarta.validation.constraints.NotBlank,CharSequence>
Check that a character sequence is not null nor empty after removing any leading or trailing whitespace.
Author:
Guillaume Smet
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isValid(CharSequence charSequence, jakarta.validation.ConstraintValidatorContext constraintValidatorContext)
    Checks that the character sequence is not null nor 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
  • Constructor Details

    • NotBlankValidator

      public NotBlankValidator()
  • Method Details

    • isValid

      public boolean isValid(CharSequence charSequence, jakarta.validation.ConstraintValidatorContext constraintValidatorContext)
      Checks that the character sequence is not null nor empty after removing any leading or trailing whitespace.
      Specified by:
      isValid in interface jakarta.validation.ConstraintValidator<jakarta.validation.constraints.NotBlank,CharSequence>
      Parameters:
      charSequence - the character sequence to validate
      constraintValidatorContext - context in which the constraint is evaluated
      Returns:
      returns true if the string is not null and the length of the trimmed charSequence is strictly superior to 0, false otherwise