Class QNameParser<T extends org.antlr.v4.runtime.ParserRuleContext>

java.lang.Object
org.pgcodekeeper.core.database.base.parser.QNameParser<T>
Type Parameters:
T - the type of parser context being processed

public final class QNameParser<T extends org.antlr.v4.runtime.ParserRuleContext> extends Object
Utility class for parsing and processing qualified names (schema.object names) in SQL statements. Supports extracting individual name components from schema-qualified identifiers.
  • Constructor Summary

    Constructors
    Constructor
    Description
    QNameParser(List<T> parts, List<Object> errors)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the first name component from this qualified name.
    static <T extends org.antlr.v4.runtime.ParserRuleContext>
    String
    Gets the first (leftmost) name component from a list of identifiers.
    static <T extends org.antlr.v4.runtime.ParserRuleContext>
    T
    Gets the context for the first name component.
     
    Gets the schema name from this qualified name.
    static <T extends org.antlr.v4.runtime.ParserRuleContext>
    String
    Gets the schema name from a qualified identifier.
    static <T extends org.antlr.v4.runtime.ParserRuleContext>
    T
    Gets the context for the schema name component.
    Gets the second name component from this qualified name.
    static <T extends org.antlr.v4.runtime.ParserRuleContext>
    String
    Gets the second name component from a list of identifiers.
    static <T extends org.antlr.v4.runtime.ParserRuleContext>
    T
    Gets the context for the second name component.
    Gets the third name component from this qualified name.
    static <T extends org.antlr.v4.runtime.ParserRuleContext>
    String
    Gets the third name component from a list of identifiers.
    static <T extends org.antlr.v4.runtime.ParserRuleContext>
    T
    Gets the context for the third name component.
    boolean
    Checks if any errors occurred during parsing.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getFirstName

      public static <T extends org.antlr.v4.runtime.ParserRuleContext> String getFirstName(List<T> ids)
      Gets the first (leftmost) name component from a list of identifiers.
      Parameters:
      ids - list of identifier contexts
      Returns:
      first name component or null if not available
    • getSecondName

      public static <T extends org.antlr.v4.runtime.ParserRuleContext> String getSecondName(List<T> ids)
      Gets the second name component from a list of identifiers.
      Parameters:
      ids - list of identifier contexts
      Returns:
      second name component or null if not available
    • getThirdName

      public static <T extends org.antlr.v4.runtime.ParserRuleContext> String getThirdName(List<T> ids)
      Gets the third name component from a list of identifiers.
      Parameters:
      ids - list of identifier contexts
      Returns:
      third name component or null if not available
    • getFirstNameCtx

      public static <T extends org.antlr.v4.runtime.ParserRuleContext> T getFirstNameCtx(List<T> ids)
      Gets the context for the first name component.
      Parameters:
      ids - list of identifier contexts
      Returns:
      parser context for first name or null
    • getSecondNameCtx

      public static <T extends org.antlr.v4.runtime.ParserRuleContext> T getSecondNameCtx(List<T> ids)
      Gets the context for the second name component.
      Parameters:
      ids - list of identifier contexts
      Returns:
      parser context for second name or null
    • getThirdNameCtx

      public static <T extends org.antlr.v4.runtime.ParserRuleContext> T getThirdNameCtx(List<T> ids)
      Gets the context for the third name component.
      Parameters:
      ids - list of identifier contexts
      Returns:
      parser context for third name or null
    • getSchemaName

      public static <T extends org.antlr.v4.runtime.ParserRuleContext> String getSchemaName(List<T> ids)
      Gets the schema name from a qualified identifier.
      Parameters:
      ids - list of identifier contexts
      Returns:
      schema name or null if not qualified
    • getSchemaNameCtx

      public static <T extends org.antlr.v4.runtime.ParserRuleContext> T getSchemaNameCtx(List<T> ids)
      Gets the context for the schema name component.
      Parameters:
      ids - list of identifier contexts
      Returns:
      parser context for schema name or null
    • getIds

      public List<T> getIds()
    • getFirstName

      public String getFirstName()
      Gets the first name component from this qualified name.
      Returns:
      first name component or null
    • getSecondName

      public String getSecondName()
      Gets the second name component from this qualified name.
      Returns:
      second name component or null
    • getThirdName

      public String getThirdName()
      Gets the third name component from this qualified name.
      Returns:
      third name component or null
    • getSchemaName

      public String getSchemaName()
      Gets the schema name from this qualified name.
      Returns:
      schema name or null if not qualified
    • hasErrors

      public boolean hasErrors()
      Checks if any errors occurred during parsing.
      Returns:
      true if parsing errors were encountered