Class DatabaseType

All Implemented Interfaces:
Expression

public final class DatabaseType extends AbstractDoubleEncapsulatedExpression
This expression represents the database specific data type, which may include size and scale.
BNF: database_type ::= data_type_literal [( [numeric_literal [, numeric_literal]] )]
BNF: data_type_literal ::= [CHAR, VARCHAR, NUMERIC, INTEGER, DATE, TIME, TIMESTAMP, etc]

Example: CASE(e.name AS VARCHAR(20))

Version:
2.5
Author:
Pascal Filion
  • Constructor Details

    • DatabaseType

      public DatabaseType(AbstractExpression parent, String databaseType)
      Creates a new DatabaseType.
      Parameters:
      parent - The parent of this expression
      databaseType - The database type
  • Method Details

    • accept

      public void accept(ExpressionVisitor visitor)
      Description copied from interface: Expression
      Visits this Expression by the given visitor.
      Parameters:
      visitor - The ExpressionVisitor to visit this object
    • getQueryBNF

      public JPQLQueryBNF getQueryBNF()
      Description copied from interface: Expression
      Returns the BNF of this Expression.
      Returns:
      The JPQLQueryBNF, which represents the grammar of this Expression
    • isSecondExpressionOptional

      protected boolean isSecondExpressionOptional()
      Description copied from class: AbstractDoubleEncapsulatedExpression
      Determines whether the second expression is optional or not.
      Overrides:
      isSecondExpressionOptional in class AbstractDoubleEncapsulatedExpression
      Returns:
      true if the second expression is optional; false if it is required
    • parameterExpressionBNF

      public String parameterExpressionBNF(int index)
      Description copied from class: AbstractDoubleEncapsulatedExpression
      Returns the BNF to be used to parse one of the encapsulated expression.
      Specified by:
      parameterExpressionBNF in class AbstractDoubleEncapsulatedExpression
      Parameters:
      index - The position of the encapsulated Expression that needs to be parsed within the parenthesis, which starts at position 0
      Returns:
      The BNF to be used to parse one of the encapsulated expression
    • shouldParseRightParenthesis

      protected boolean shouldParseRightParenthesis(WordParser wordParser, boolean tolerant)
      Description copied from class: AbstractEncapsulatedExpression
      Determines whether the right parenthesis should be parsed or not by this expression. There is a possible case where this expression should have optional left and right parenthesis. If there is no left parenthesis, then it would most likely mean the right parenthesis does not belong to this expression.
      Overrides:
      shouldParseRightParenthesis in class AbstractEncapsulatedExpression
      Parameters:
      wordParser - The text to parse based on the current position of the cursor
      tolerant - Determines whether the parsing system should be tolerant, meaning if it should try to parse invalid or incomplete queries
      Returns:
      true if the right parenthesis should be owned by this expression if it is the next character to scan; false otherwise