Class RegexValidator

  • All Implemented Interfaces:
    org.stagemonitor.configuration.ConfigurationOption.Validator<java.lang.String>

    public class RegexValidator
    extends java.lang.Object
    implements org.stagemonitor.configuration.ConfigurationOption.Validator<java.lang.String>
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.stagemonitor.configuration.ConfigurationOption.Validator

        org.stagemonitor.configuration.ConfigurationOption.Validator.OptionalValidatorAdapter<T extends java.lang.Object>
    • Method Detail

      • of

        public static RegexValidator of​(java.lang.String regex)
        Constructs a RegexValidator which validates a string based on a Pattern
        Parameters:
        regex - the regular expression which should be used to validate an input string
        Returns:
        a RegexValidator which validates a string based on a Pattern
      • of

        public static RegexValidator of​(java.lang.String regex,
                                        java.lang.String errorMessagePattern)
        Constructs a RegexValidator which validates a string based on a Pattern
        Parameters:
        regex - the regular expression which should be used to validate an input string
        errorMessagePattern - a error message format pattern. The placeholder {0} contains the actual value, while the placeholder {1} represents the regex.
        Returns:
        a RegexValidator which validates a string based on a Pattern
      • assertValid

        public void assertValid​(@Nullable
                                java.lang.String value)
        Specified by:
        assertValid in interface org.stagemonitor.configuration.ConfigurationOption.Validator<java.lang.String>