public class

OptionalStringValidator

extends Object
implements ConstraintValidator<A extends Annotation, T>
java.lang.Object
   ↳ com.atlassian.bitbucket.validation.OptionalStringValidator

Class Overview

Validator for the OptionalString annotation.

Summary

Public Constructors
OptionalStringValidator()
Public Methods
void initialize(OptionalString constraintAnnotation)
boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext)
Checks that the trimmed string is not empty.
[Expand]
Inherited Methods
From class java.lang.Object
From interface javax.validation.ConstraintValidator

Public Constructors

public OptionalStringValidator ()

Public Methods

public void initialize (OptionalString constraintAnnotation)

public boolean isValid (String s, ConstraintValidatorContext constraintValidatorContext)

Checks that the trimmed string is not empty.

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.