com.vaadin.data.validator.


Class RegexpValidator

java.lang.Object
  com.vaadin.data.validator.AbstractValidator
      com.vaadin.data.validator.AbstractStringValidator
          com.vaadin.data.validator.RegexpValidator

All Implemented Interfaces:

Validator, Serializable

Direct Known Subclasses:

EmailValidator

public class RegexpValidator
extends AbstractStringValidator

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 java.util.regex.Pattern#sum

See AbstractStringValidator for more information.

Since:

5.4

Version:

6.8.18

Author:

Vaadin Ltd.

See Also:

Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.vaadin.data.Validator
Validator.EmptyValueException, Validator.InvalidValueException
 
Constructor Summary
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.
 
Method Summary
protected  boolean isValidString(String value)
          Checks if the given string is valid.
 
Methods inherited from class com.vaadin.data.validator.AbstractStringValidator
isValid
 
Methods inherited from class com.vaadin.data.validator.AbstractValidator
getErrorMessage, setErrorMessage, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegexpValidator

public RegexpValidator(String regexp,
                       String errorMessage)

Creates a validator for checking that the regular expression matches the complete string to validate.

Parameters:
regexp - a Java regular expression
errorMessage - the message to display in case the value does not validate.

RegexpValidator

public RegexpValidator(String regexp,
                       boolean complete,
                       String errorMessage)

Creates a validator for checking that the regular expression matches the string to validate.

Parameters:
regexp - a Java regular expression
complete - true to use check for a complete match, false to look for a matching substring
errorMessage - the message to display in case the value does not validate.

Method Detail

isValidString

protected boolean isValidString(String value)

Description copied from class: AbstractStringValidator

Checks if the given string is valid.

Specified by:
isValidString in class AbstractStringValidator

Parameters:
value - String to check. Can never be null.
Returns:
true if the string is valid, false otherwise