Class RegexTextValidator

  • All Implemented Interfaces:
    Validator

    public class RegexTextValidator
    extends java.lang.Object
    implements Validator
    A validator for a regular expression.
    See Also:
    Pattern
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.regex.Pattern getPattern()  
      boolean isValid​(java.lang.String text)
      Determines if a text value is valid based on the rules of the validator.
      void setPattern​(java.lang.String regexPattern)  
      void setPattern​(java.util.regex.Pattern pattern)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RegexTextValidator

        public RegexTextValidator()
      • RegexTextValidator

        public RegexTextValidator​(java.util.regex.Pattern p)
      • RegexTextValidator

        public RegexTextValidator​(java.lang.String regexPattern)
    • Method Detail

      • getPattern

        public java.util.regex.Pattern getPattern()
      • setPattern

        public void setPattern​(java.util.regex.Pattern pattern)
      • setPattern

        public void setPattern​(java.lang.String regexPattern)
        Parameters:
        regexPattern - The new pattern for this validator.
        Throws:
        java.util.regex.PatternSyntaxException - If the expression's syntax is invalid.
      • isValid

        public boolean isValid​(java.lang.String text)
        Description copied from interface: Validator
        Determines if a text value is valid based on the rules of the validator.
        Specified by:
        isValid in interface Validator
        Parameters:
        text - The text to test.
        Returns:
        true if the value is valid; false, otherwise.