Module org.jooq
Package org.jooq

Interface ParseContext

All Superinterfaces:
Scope

public interface ParseContext extends Scope
A publicly available API for the internal parse context that allows for parsing SQL fragements.

This type is a Scope with independent lifecycle and its own Scope.data() map.

Author:
Lukas Eder
  • Method Details Link icon

    • parseDialect Link icon

      @NotNull @NotNull SQLDialect parseDialect()
      Convenient access to Settings.getParseDialect().
    • parseFamily Link icon

      @NotNull @NotNull SQLDialect parseFamily()
      Convenient access to Settings.getParseDialect()'s family.
    • parseCategory Link icon

      @NotNull @NotNull SQLDialectCategory parseCategory()
      Convenient access to Settings.getParseDialect()'s category.
    • languageContext Link icon

      @NotNull @NotNull LanguageContext languageContext()
      The current language context.
    • characters Link icon

      char @NotNull [] characters()
      Get access to the underlying SQL string.
    • characters Link icon

      @NotNull @NotNull ParseContext characters(char[] newCharacters)
      Update the underlying SQL string.

      This replaces the current SQL string being parsed by a new one. Callers must ensure this ParseContext maintains a consistent characters() and position().

    • character Link icon

      char character()
      The character at the current position().
    • character Link icon

      char character(int pos)
      The character at position position(int).
    • position Link icon

      int position()
      The current position.
    • position Link icon

      boolean position(int newPosition)
      Set the current position to a new one.
      Returns:
      Always returns true.
    • peek Link icon

      boolean peek(char c)
      Peek at the next character.
      Returns:
      Whether the next character is the expected one.
      See Also:
    • peek Link icon

      boolean peek(String string)
      Peek at the next characters.
      Returns:
      Whether the next characters are the expected ones.
      See Also:
    • peekKeyword Link icon

      boolean peekKeyword(String keyword)
      Peek at the next keyword.
      Returns:
      Whether the next keyword is the expected one.
      See Also:
    • peekKeyword Link icon

      boolean peekKeyword(String... keywords)
      Peek at the next keyword.
      Returns:
      Whether the next keyword is any of the expected ones.
      See Also:
    • parse Link icon

      boolean parse(char c) throws ParserException
      Parse a single character or fail if it cannot be parsed.
      Returns:
      Always returns true.
      Throws:
      ParserException - if the character could not be parsed.
    • parseIf Link icon

      boolean parseIf(char c)
      Try parsing a single character.
      Returns:
      Whether the character could be parsed.
    • parse Link icon

      boolean parse(String string) throws ParserException
      Parse a string or fail if it cannot be parsed.
      Returns:
      Always returns true.
      Throws:
      ParserException - if the string could not be parsed.
    • parseIf Link icon

      boolean parseIf(String string)
      Try parsing a string.
      Returns:
      Whether the string could be parsed.
    • parseKeyword Link icon

      boolean parseKeyword(String keyword) throws ParserException
      Parse a keyword or fail if the keyword cannot be parsed.

      The argument keyword should be in UPPER CASE and is allowed to contain spaces. Spaces separating keyword parts are interpreted as any arbitrary amount of whitespace. For example, when parsing "ORDER BY", then "order by" will be parsed as well.

      Returns:
      Always returns true.
      Throws:
      ParserException - if the keyword could not be parsed.
    • parseKeywordIf Link icon

      boolean parseKeywordIf(String keyword)
      Try parsing a keyword.

      The argument keyword should be in UPPER CASE and is allowed to contain spaces. Spaces separating keyword parts are interpreted as any arbitrary amount of whitespace. For example, when parsing "ORDER BY", then "order by" will be parsed as well.

      Returns:
      Whether the keyword could be parsed.
    • parseKeywordIf Link icon

      boolean parseKeywordIf(String... keywords)
      Try parsing any keyword.
      Returns:
      Whether any of the keywords could be parsed.
    • parseKeyword Link icon

      boolean parseKeyword(String... keywords) throws ParserException
      Parse any keyword or fail if none of the keywords could be parsed.
      Returns:
      Always returns true.
      Throws:
      ParserException - if none of the keywords could be parsed.
    • parseIdentifier Link icon

      @NotNull @NotNull Name parseIdentifier() throws ParserException
      Parse an (unqualified) identifier or fail if the current token is not an identifier.
      Returns:
      The parsed identifier.
      Throws:
      ParserException - if no identifier could be parsed.
    • parseIdentifierIf Link icon

      @Nullable @Nullable Name parseIdentifierIf()
      Try parsing an (unqualified) identifier.
      Returns:
      The identifier if it could be parsed, or null if the current token is not an identifier.
    • parseName Link icon

      @NotNull @NotNull Name parseName() throws ParserException
      Parse a name (a qualified identifier) or fail if the current token is not a name.
      Returns:
      The parsed name.
      Throws:
      ParserException - if no name could be parsed.
    • parseNameIf Link icon

      @Nullable @Nullable Name parseNameIf()
      Try parsing a name (a qualified identifier).
      Returns:
      The name if it could be parsed, or null if the current token is not a name.
    • parseFunctionNameIf Link icon

      boolean parseFunctionNameIf(String name)
      Try parsing a function name.
      Returns:
      Whether the function name could be parsed.
    • parseFunctionNameIf Link icon

      boolean parseFunctionNameIf(String... names)
      Try parsing any function name.
      Returns:
      Whether any function name could be parsed.
    • parseStringLiteral Link icon

      @NotNull @NotNull String parseStringLiteral() throws ParserException
      Parse a string literal or fail if the current token is not a string literal.
      Returns:
      The parsed string literal.
      Throws:
      ParserException - if no string literal could be parsed.
    • parseStringLiteralIf Link icon

      @Nullable @Nullable String parseStringLiteralIf()
      Try parsing a string literal.
      Returns:
      The string literal if it could be parsed, or null if the current token is not a string literal.
    • parseUnsignedIntegerLiteral Link icon

      @NotNull @NotNull Long parseUnsignedIntegerLiteral() throws ParserException
      Parse an unsigned integer literal or fail if the current token is not an unsigned integer literal.
      Returns:
      The unsigned integer literal.
      Throws:
      ParserException - if no unsigned integer literal could be parsed.
    • parseUnsignedIntegerLiteralIf Link icon

      @Nullable @Nullable Long parseUnsignedIntegerLiteralIf()
      Try parsing an unsigned integer literal.
      Returns:
      The unsigned integer literal if it could be parsed, or null if the current token is not an unsigned integer literal.
    • parseSignedIntegerLiteral Link icon

      @NotNull @NotNull Long parseSignedIntegerLiteral() throws ParserException
      Parse a signed integer literal or fail if the current token is not a signed integer literal.
      Returns:
      The signed integer literal.
      Throws:
      ParserException - if no signed integer literal could be parsed.
    • parseSignedIntegerLiteralIf Link icon

      @Nullable @Nullable Long parseSignedIntegerLiteralIf()
      Try parsing an signed integer literal.
      Returns:
      The signed integer literal if it could be parsed, or null if the current token is not an signed integer literal.
    • parseDataType Link icon

      @NotNull @NotNull DataType<?> parseDataType() throws ParserException
      Parse a DataType expression or fail if the current expression is not a data type.
      Returns:
      The data type.
      Throws:
      ParserException - if no data type expression could be parsed.
    • parseField Link icon

      @NotNull @NotNull Field<?> parseField() throws ParserException
      Parse a Field expression or fail if the current expression is not a field.
      Returns:
      The parsed field.
      Throws:
      ParserException - if no field expression could be parsed.
    • parseSortField Link icon

      @NotNull @NotNull SortField<?> parseSortField() throws ParserException
      Parse a SortField expression or fail if the current expression is not a sort field.
      Returns:
      The parsed sort field.
      Throws:
      ParserException - if no sort field expression could be parsed.
    • parseCondition Link icon

      @NotNull @NotNull Condition parseCondition() throws ParserException
      Parse a Condition expression or fail if the current expression is not a condition.
      Returns:
      The parsed condition.
      Throws:
      ParserException - if no condition expression could be parsed.
    • parseTable Link icon

      @NotNull @NotNull Table<?> parseTable() throws ParserException
      Parse a Table expression or fail if the current expression is not a table.
      Returns:
      The parsed table.
      Throws:
      ParserException - if no table expression could be parsed.
    • parseList Link icon

      @NotNull <T> @NotNull List<T> parseList(String separator, Function<? super ParseContext,? extends T> element)
      Convenience method to parse a list of at least 1 elements.
    • parseList Link icon

      @NotNull <T> @NotNull List<T> parseList(Predicate<? super ParseContext> separator, Function<? super ParseContext,? extends T> element)
      Convenience method to parse a list of at least 1 elements.
    • parseParenthesised Link icon

      <T> T parseParenthesised(Function<? super ParseContext,? extends T> content)
      Convenience method to parse parenthesised content.
    • parseParenthesised Link icon

      <T> T parseParenthesised(char open, Function<? super ParseContext,? extends T> content, char close)
      Convenience method to parse parenthesised content.
    • parseParenthesised Link icon

      <T> T parseParenthesised(String open, Function<? super ParseContext,? extends T> content, String close)
      Convenience method to parse parenthesised content.
    • exception Link icon

      @NotNull @NotNull ParserException exception(String message)
      An exception that can be thrown from the current position.