Class RegExValidator

    • Constructor Detail

      • RegExValidator

        public RegExValidator​(Pattern pattern)
        Build a validator with the provided pattern.
        Parameters:
        pattern - Regex pattern.
      • RegExValidator

        public RegExValidator​(String regex)
        Build a validator by compiling the provided regex.
        Parameters:
        regex - String representation of the regex.
        See Also:
        Pattern.compile(String)
      • RegExValidator

        public RegExValidator​(String regex,
                              int flags)
        Build a validator by compiling the provided regex and associated flags.
        Parameters:
        regex - String representation of the regex.
        flags - Regex matching flags.
        See Also:
        Pattern.compile(String, int)
    • Method Detail

      • setMessageFormat

        public void setMessageFormat​(String messagePattern)
        Set the message formatter pattern to be used for validation error message. If not set, a default, generic, message format will be used.

        When formatting a message two arguments will be passed, the field name and the field value.

        Parameters:
        messagePattern - The actual message formatter patter. {0} is the field name and {1} is the field value.
        See Also:
        MessageFormat