Class RegexpValidator
java.lang.Object
com.vaadin.featurepack.data.validator.AbstractValidator<String>
com.vaadin.featurepack.data.validator.AbstractStringValidator
com.vaadin.featurepack.data.validator.RegexpValidator
- All Implemented Interfaces:
Validator,Serializable
- Direct Known Subclasses:
EmailValidator
String validator comparing the string against a Java regular expression. Both
complete matches and substring matches are supported.
For the Java regular expression syntax, see
invalid reference
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.
- Author:
- Vaadin Ltd.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.featurepack.data.Validator
Validator.EmptyValueException, Validator.InvalidValueException -
Constructor Summary
ConstructorsConstructorDescriptionRegexpValidator(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. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanisValidValue(String value) Internally check the validity of a value.Methods inherited from class com.vaadin.featurepack.data.validator.AbstractStringValidator
getTypeMethods inherited from class com.vaadin.featurepack.data.validator.AbstractValidator
getErrorMessage, isValid, isValidType, setErrorMessage, validate
-
Constructor Details
-
RegexpValidator
Creates a validator for checking that the regular expression matches the complete string to validate.- Parameters:
regexp- a Java regular expressionerrorMessage- the message to display in case the value does not validate.
-
RegexpValidator
Creates a validator for checking that the regular expression matches the string to validate.- Parameters:
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.
-
-
Method Details
-
isValidValue
Description copied from class:AbstractValidatorInternally check the validity of a value. This method can be used to perform validation in subclasses if customization of the error message is not needed. Otherwise, subclasses should overrideAbstractValidator.validate(Object)and the return value of this method is ignored. This method should not be called from outside the validator class itself.- Specified by:
isValidValuein classAbstractValidator<String>- Parameters:
value-- Returns:
-