public class NotBlankValidator extends Object implements ConstraintValidator<NotBlank,CharSequence>
Constructor and Description |
---|
NotBlankValidator() |
Modifier and Type | Method and Description |
---|---|
void |
initialize(NotBlank annotation)
Initializes the validator in preparation for
ConstraintValidator.isValid(Object, ConstraintValidatorContext) calls. |
boolean |
isValid(CharSequence charSequence,
ConstraintValidatorContext constraintValidatorContext)
Checks that the trimmed string is not empty.
|
public void initialize(NotBlank annotation)
ConstraintValidator
ConstraintValidator.isValid(Object, ConstraintValidatorContext)
calls.
The constraint annotation for a given constraint declaration
is passed.
This method is guaranteed to be called before any use of this instance for
validation.initialize
in interface ConstraintValidator<NotBlank,CharSequence>
annotation
- annotation instance for a given constraint declarationpublic boolean isValid(CharSequence charSequence, ConstraintValidatorContext constraintValidatorContext)
isValid
in interface ConstraintValidator<NotBlank,CharSequence>
charSequence
- The character sequence to validate.constraintValidatorContext
- context in which the constraint is evaluated.true
if the string is null
or the length of charSequence
between the specified
min
and max
values (inclusive), false
otherwise.Copyright © 2017 JBoss by Red Hat. All rights reserved.