EclipseLink 2.4.2, build 'v20130514-5956486' API Reference

org.eclipse.persistence.jpa.jpql.parser
Class FunctionExpressionFactory

java.lang.Object
  extended by org.eclipse.persistence.jpa.jpql.parser.ExpressionFactory
      extended by org.eclipse.persistence.jpa.jpql.parser.FunctionExpressionFactory
All Implemented Interfaces:
java.lang.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.

Version:
2.4
See Also:
FunctionExpression
Author:
James
Since:
2.4

Nested Class Summary
static class FunctionExpressionFactory.ParameterCount
          The number of parameters a FunctionExpression can have.
 
Field Summary
static java.lang.String ID
          The unique identifier for this FunctionExpressionFactory.
 
Constructor Summary
FunctionExpressionFactory(java.lang.String id, FunctionExpressionFactory.ParameterCount parameterCount, java.lang.String parameterQueryBNFId, java.lang.String... identifiers)
          Creates a new FunctionExpressionFactory.
FunctionExpressionFactory(java.lang.String id, java.lang.String... identifiers)
          Creates a new FunctionExpressionFactory.
 
Method Summary
protected  AbstractExpression buildExpression(AbstractExpression parent, WordParser wordParser, java.lang.String word, JPQLQueryBNF queryBNF, AbstractExpression expression, boolean tolerant)
          Creates a new Expression.
protected  boolean isFunctionExpression(WordParser wordParser, java.lang.String identifier)
          Determines whether the JPQL fragment is an expression of the form <IDENTIFIER>(.
 void setParameterCount(FunctionExpressionFactory.ParameterCount parameterCount)
          Sets the number of parameters a FunctionExpression can have, which will be during validation.
 void setParameterQueryBNFId(java.lang.String parameterQueryBNFId)
          Sets the BNF that will be used when parsing the function's arguments.
 
Methods inherited from class org.eclipse.persistence.jpa.jpql.parser.ExpressionFactory
compareTo, equals, getExpressionRegistry, getFallBackExpressionFactoryId, getId, hashCode, identifiers, setFallBackExpressionFactory, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ID

public static final java.lang.String ID
The unique identifier for this FunctionExpressionFactory.

See Also:
Constant Field Values
Constructor Detail

FunctionExpressionFactory

public FunctionExpressionFactory(java.lang.String id,
                                 FunctionExpressionFactory.ParameterCount parameterCount,
                                 java.lang.String parameterQueryBNFId,
                                 java.lang.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(java.lang.String id,
                                 java.lang.String... identifiers)
Creates a new FunctionExpressionFactory.

Parameters:
id - The unique identifier of this factory
identifiers - The JPQL identifiers handled by this factory
Method Detail

buildExpression

protected AbstractExpression buildExpression(AbstractExpression parent,
                                             WordParser wordParser,
                                             java.lang.String word,
                                             JPQLQueryBNF queryBNF,
                                             AbstractExpression expression,
                                             boolean tolerant)
Creates a new Expression.

Specified by:
buildExpression in class ExpressionFactory
Parameters:
parent - The parent expression
wordParser - The text to parse based on the current position of the cursor
word - The current word to parse
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 Expression representing a portion or the totality of the given text

isFunctionExpression

protected boolean isFunctionExpression(WordParser wordParser,
                                       java.lang.String identifier)
Determines whether the JPQL fragment is an expression of the form <IDENTIFIER>(.

Parameters:
wordParser - The text to parse based on the current position of the cursor
identifier - The identifier to verify if it's for an expression or for possibly for a variable name
Returns:
true if the identifier is followed by '('; false otherwise

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(java.lang.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

EclipseLink 2.4.2, build 'v20130514-5956486' API Reference