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 voidassertValid(java.lang.String value)static RegexValidatorof(java.lang.String regex)Constructs aRegexValidatorwhich validates a string based on aPatternstatic RegexValidatorof(java.lang.String regex, java.lang.String errorMessagePattern)Constructs aRegexValidatorwhich validates a string based on aPattern
-
-
-
Method Detail
-
of
public static RegexValidator of(java.lang.String regex)
Constructs aRegexValidatorwhich validates a string based on aPattern- Parameters:
regex- the regular expression which should be used to validate an input string- Returns:
- a
RegexValidatorwhich validates a string based on aPattern
-
of
public static RegexValidator of(java.lang.String regex, java.lang.String errorMessagePattern)
Constructs aRegexValidatorwhich 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
RegexValidatorwhich validates a string based on aPattern
-
assertValid
public void assertValid(@Nullable java.lang.String value)- Specified by:
assertValidin interfaceorg.stagemonitor.configuration.ConfigurationOption.Validator<java.lang.String>
-
-