Class RegexValidator
- java.lang.Object
-
- co.elastic.apm.agent.configuration.validation.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>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assertValid(java.lang.String value)
static RegexValidator
of(java.lang.String regex)
Constructs aRegexValidator
which validates a string based on aPattern
static RegexValidator
of(java.lang.String regex, java.lang.String errorMessagePattern)
Constructs aRegexValidator
which validates a string based on aPattern
-
-
-
Method Detail
-
of
public static RegexValidator of(java.lang.String regex)
Constructs aRegexValidator
which validates a string based on aPattern
- Parameters:
regex
- the regular expression which should be used to validate an input string- Returns:
- a
RegexValidator
which validates a string based on aPattern
-
of
public static RegexValidator of(java.lang.String regex, java.lang.String errorMessagePattern)
Constructs aRegexValidator
which validates a string based on aPattern
- Parameters:
regex
- the regular expression which should be used to validate an input stringerrorMessagePattern
- 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 aPattern
-
assertValid
public void assertValid(@Nullable java.lang.String value)
- Specified by:
assertValid
in interfaceorg.stagemonitor.configuration.ConfigurationOption.Validator<java.lang.String>
-
-