public class RegexpValidator extends AbstractStringValidator
For the Java regular expression syntax, see
java.util.regex.Pattern#sum
See AbstractStringValidator
for more information.
An empty string or a null is always accepted - use the required flag on
fields or a separate validator (or override isValidValue(String)
) to
fail on empty values.
Validator.EmptyValueException, Validator.InvalidValueException
Constructor and Description |
---|
RegexpValidator(String regexp,
boolean complete,
String errorMessage)
Creates a validator for checking that the regular expression matches the
string to validate.
|
RegexpValidator(String regexp,
String errorMessage)
Creates a validator for checking that the regular expression matches the
complete string to validate.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
isValidValue(String value)
Internally check the validity of a value.
|
getType
getErrorMessage, isValid, isValidType, setErrorMessage, validate
public RegexpValidator(String regexp, String errorMessage)
regexp
- a Java regular expressionerrorMessage
- the message to display in case the value does not validate.public RegexpValidator(String regexp, boolean complete, String errorMessage)
regexp
- a Java regular expressioncomplete
- true to use check for a complete match, false to look for a
matching substringerrorMessage
- the message to display in case the value does not validate.protected boolean isValidValue(String value)
AbstractValidator
AbstractValidator.validate(Object)
and the return value of this method is ignored.
This method should not be called from outside the validator class itself.isValidValue
in class AbstractValidator<String>
Copyright © 2019 Vaadin Ltd. All rights reserved.