congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
RegexValidator
Code IndexAdd Tabnine to your IDE (free)

How to use
RegexValidator
in
co.elastic.apm.agent.configuration.validation

Best Java code snippets using co.elastic.apm.agent.configuration.validation.RegexValidator (Showing top 3 results out of 315)

origin: elastic/apm-agent-java

/**
 * Constructs a {@link RegexValidator} which validates a string based on a {@link Pattern}
 *
 * @param regex the regular expression which should be used to validate an input string
 * @return a {@link RegexValidator} which validates a string based on a {@link Pattern}
 */
public static RegexValidator of(String regex) {
  return new RegexValidator(regex, "Value \"{0}\" does not match regex {1}");
}
origin: elastic/apm-agent-java

  @Test
  void testRegexValidator() {
    SoftAssertions.assertSoftly(softly -> {
      softly.assertThatCode(() -> RegexValidator.of("foo").assertValid("foo")).doesNotThrowAnyException();
      // checking for nullness is not the responsibility of the validator, but it must be null safe
      softly.assertThatCode(() -> RegexValidator.of("foo").assertValid(null)).doesNotThrowAnyException();
      softly.assertThatCode(() -> RegexValidator.of("foo").assertValid("bar"))
        .isInstanceOf(IllegalArgumentException.class)
        .hasMessage("Value \"bar\" does not match regex foo");
      softly.assertThatCode(() -> RegexValidator.of("foo", "{0} is not {1}").assertValid("bar"))
        .isInstanceOf(IllegalArgumentException.class)
        .hasMessage("bar is not foo");
    });
  }
}
origin: elastic/apm-agent-java

/**
 * Constructs a {@link RegexValidator} which validates a string based on a {@link Pattern}
 *
 * @param regex               the regular expression which should be used to validate an input string
 * @param errorMessagePattern a error message format pattern. The placeholder {@code {0}} contains the actual value,
 *                            while the placeholder {@code {1}} represents the regex.
 * @return a {@link RegexValidator} which validates a string based on a {@link Pattern}
 */
public static RegexValidator of(String regex, String errorMessagePattern) {
  return new RegexValidator(regex, errorMessagePattern);
}
co.elastic.apm.agent.configuration.validationRegexValidator

Most used methods

  • <init>
  • assertValid
  • of
    Constructs a RegexValidator which validates a string based on a Pattern

Popular in Java

  • Running tasks concurrently on multiple threads
  • setRequestProperty (URLConnection)
  • startActivity (Activity)
  • getResourceAsStream (ClassLoader)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now