Class OptionalStringValidator

java.lang.Object
com.atlassian.bitbucket.validation.OptionalStringValidator
All Implemented Interfaces:
javax.validation.ConstraintValidator<OptionalString,String>

public class OptionalStringValidator extends Object implements javax.validation.ConstraintValidator<OptionalString,String>
Validator for the OptionalString annotation.
  • Constructor Details

    • OptionalStringValidator

      public OptionalStringValidator()
  • Method Details

    • initialize

      public void initialize(OptionalString constraintAnnotation)
      Specified by:
      initialize in interface javax.validation.ConstraintValidator<OptionalString,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<OptionalString,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.