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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
initialize
(OptionalString constraintAnnotation) boolean
Checks that the trimmed string is not empty.
-
Constructor Details
-
OptionalStringValidator
public OptionalStringValidator()
-
-
Method Details
-
initialize
- Specified by:
initialize
in interfacejavax.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 interfacejavax.validation.ConstraintValidator<OptionalString,
String> - Parameters:
s
- The string to validate.constraintValidatorContext
- context in which the constraint is evaluated.- Returns:
- Returns
true
if the string isnull
or the length ofs
between the specifiedmin
andmax
values (inclusive),false
otherwise.
-