Module org.firebirdsql.jaybird
Package org.firebirdsql.jdbc.metadata

# Class MetadataPattern

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

@InternalApi public final class MetadataPattern extends Object
Holder of a database metadata pattern.

Provides information whether the pattern is the all-pattern, or if the condition needs a normal equality comparison, a SQL `LIKE`, or a SQL `STARTING WITH`.

Since:
  4.0
Author:
  Mark Rotteveel

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `MetadataPattern.ConditionType`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static MetadataPattern`
  `compile(String metadataPattern)`
  Compiles the metadata pattern.
  `static boolean`
  `containsPatternSpecialChars(String pattern)`
  Scans string to determine if string contains any of `\_%` that indicates additional processing is needed.
  `static String`
  `escapeWildcards(String objectName)`
  Escapes the like wildcards and escape (`\_%` in the provided search string with a `\`.
  `MetadataPattern.ConditionType`
  `getConditionType()`
  `String`
  `getConditionValue()`
  `static boolean`
  `isAllCondition(String metadataPattern)`
  `static boolean`
  `isPatternSpecialChar(char charVal)`
  Checks if character is a database metadata pattern special.
  `String`
  `renderCondition(String columnName)`
  Renders the condition for this pattern.
  `MetadataPatternMatcher`
  `toMetadataPatternMatcher()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### getConditionType

    public MetadataPattern.ConditionType getConditionType()
    Returns:
      Type of condition to use for this metadata pattern

  - ### getConditionValue

    public String getConditionValue()
    Returns:
      Value for the condition; `null` signals no value

  - ### renderCondition

    public String renderCondition(String columnName)
    Renders the condition for this pattern.
    Parameters:
      `columnName` - column name
    Returns:
      Rendered condition (can be empty string if there is no condition).

  - ### toMetadataPatternMatcher

    public MetadataPatternMatcher toMetadataPatternMatcher()
    Returns:
      Metadata pattern matcher for this metadata pattern

  - ### compile

    public static MetadataPattern compile(String metadataPattern)
    Compiles the metadata pattern.
    Parameters:
      `metadataPattern` - Metadata pattern string
    Returns:
      MetadataPattern instance

  - ### containsPatternSpecialChars

    public static boolean containsPatternSpecialChars(String pattern)
    Scans string to determine if string contains any of `\_%` that indicates additional processing is needed.
    Parameters:
      `pattern` - metadata pattern
    Returns:
      `true` if the string contains any like special characters

  - ### isPatternSpecialChar

    public static boolean isPatternSpecialChar(char charVal)
    Checks if character is a database metadata pattern special.
    Parameters:
      `charVal` - Character to check
    Returns:
      `true` if `charVal` is a pattern special (`\_%`)

  - ### escapeWildcards

    public static String escapeWildcards(String objectName)
    Escapes the like wildcards and escape (`\_%` in the provided search string with a `\`.
    Parameters:
      `objectName` - Object name to escape.
    Returns:
      Object name with wildcards escaped.

  - ### isAllCondition

    public static boolean isAllCondition(String metadataPattern)