Class MetadataPatternMatcher

java.lang.Object
org.firebirdsql.jdbc.metadata.MetadataPatternMatcher

@InternalApi public abstract sealed class MetadataPatternMatcher extends Object
Emulates behavior of a database metadata pattern.

This behaves similar to (but not 100% identical to) a SQL LIKE pattern with ESCAPE '\' clause.

This implementation is not thread-safe.

Since:
4.0
Author:
Mark Rotteveel
  • Method Details

    • fromPattern

      public static MetadataPatternMatcher fromPattern(MetadataPattern metadataPattern)
      Derives a metadata pattern matcher from a metadata pattern instance.
      Parameters:
      metadataPattern - Metadata pattern instance
      Returns:
      Matcher for metadataPattern
    • matches

      public abstract boolean matches(String value)
      Checks if value matches the pattern of this matcher.

      This method is not thread-safe.

      Parameters:
      value - Value to check
      Returns:
      true if value matches this pattern, false otherwise
    • patternToRegex

      public static String patternToRegex(String metadataPattern)
      Creates a regular expression pattern equivalent to the provided database metadata pattern.
      Parameters:
      metadataPattern - database metadata pattern
      Returns:
      Pattern for the provided like string.