Class FunctionExpressionFactory

java.lang.Object
org.eclipse.persistence.jpa.jpql.parser.ExpressionFactory
org.eclipse.persistence.jpa.jpql.parser.FunctionExpressionFactory
All Implemented Interfaces:
Comparable<ExpressionFactory>

public final class FunctionExpressionFactory extends ExpressionFactory
This FunctionExpressionFactory creates a new FunctionExpression when the portion of the query to parse starts with an identifier related to a SQL function.
Since:
2.4
Version:
2.5
See Also:
  • Field Details

  • Constructor Details

    • FunctionExpressionFactory

      public FunctionExpressionFactory(String id, FunctionExpressionFactory.ParameterCount parameterCount, String parameterQueryBNFId, String... identifiers)
      Creates a new FunctionExpressionFactory.
      Parameters:
      id - The unique identifier of this factory
      parameterCount - The number of parameters a FunctionExpression can have
      parameterQueryBNFId - The unique identifier of the JPQLQueryBNF that will be used to parse the arguments of the function expression
      identifiers - The JPQL identifiers handled by this factory
    • FunctionExpressionFactory

      public FunctionExpressionFactory(String id, String... identifiers)
      Creates a new FunctionExpressionFactory.
      Parameters:
      id - The unique identifier of this factory
      identifiers - The JPQL identifiers handled by this factory
  • Method Details

    • buildExpression

      protected AbstractExpression buildExpression(AbstractExpression parent, WordParser wordParser, String word, JPQLQueryBNF queryBNF, AbstractExpression expression, boolean tolerant)
      Description copied from class: ExpressionFactory
      Creates a new Expression.
      Specified by:
      buildExpression in class ExpressionFactory
      Parameters:
      parent - The parent AbstractExpression
      wordParser - The text to parse based on the current position of the cursor
      word - The current word being parsed
      queryBNF - The BNF grammar that was used to identifier this factory to be capable to parse a portion of the query
      expression - During the parsing, it is possible the first part of an expression was parsed which needs to be used as a sub-expression of the newly created expression
      Returns:
      A new AbstractExpression representing the portion or the totality of the text held by WordParser starting at the cursor position
    • setParameterCount

      public void setParameterCount(FunctionExpressionFactory.ParameterCount parameterCount)
      Sets the number of parameters a FunctionExpression can have, which will be during validation.
      Parameters:
      parameterCount - The number of parameters
    • setParameterQueryBNFId

      public void setParameterQueryBNFId(String parameterQueryBNFId)
      Sets the BNF that will be used when parsing the function's arguments.
      Parameters:
      parameterQueryBNFId - The unique identifier of the JPQLQueryBNF that will be used to parse the arguments of the function expression