public final class FunctionExpressionFactory extends ExpressionFactory
FunctionExpressionFactory
creates a new FunctionExpression
when the portion
of the query to parse starts with an identifier related to a SQL function.FunctionExpression
Modifier and Type | Class and Description |
---|---|
static class |
FunctionExpressionFactory.ParameterCount
The number of parameters a
FunctionExpression can have. |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ID
The unique identifier for this
FunctionExpressionFactory . |
Constructor and Description |
---|
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 . |
Modifier and Type | Method and Description |
---|---|
protected AbstractExpression |
buildExpression(AbstractExpression parent,
WordParser wordParser,
java.lang.String word,
JPQLQueryBNF queryBNF,
AbstractExpression expression,
boolean tolerant)
Creates a new
Expression . |
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.
|
compareTo, equals, getExpressionRegistry, getId, hashCode, identifiers, toString
public static final java.lang.String ID
FunctionExpressionFactory
.public FunctionExpressionFactory(java.lang.String id, FunctionExpressionFactory.ParameterCount parameterCount, java.lang.String parameterQueryBNFId, java.lang.String... identifiers)
FunctionExpressionFactory
.id
- The unique identifier of this factoryparameterCount
- The number of parameters
a FunctionExpression
can haveparameterQueryBNFId
- The unique identifier of the JPQLQueryBNF
that will be used
to parse the arguments of the function expressionidentifiers
- The JPQL identifiers handled by this factorypublic FunctionExpressionFactory(java.lang.String id, java.lang.String... identifiers)
FunctionExpressionFactory
.id
- The unique identifier of this factoryidentifiers
- The JPQL identifiers handled by this factoryprotected AbstractExpression buildExpression(AbstractExpression parent, WordParser wordParser, java.lang.String word, JPQLQueryBNF queryBNF, AbstractExpression expression, boolean tolerant)
Expression
.buildExpression
in class ExpressionFactory
parent
- The parent AbstractExpression
wordParser
- The text to parse based on the current position of the cursorword
- The current word being parsedqueryBNF
- The BNF grammar that was used to identifier this factory to be capable to
parse a portion of the queryexpression
- 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 expressionAbstractExpression
representing the portion or the totality of the
text held by WordParser
starting at the cursor positionpublic void setParameterCount(FunctionExpressionFactory.ParameterCount parameterCount)
FunctionExpression
can have, which will be during
validation.parameterCount
- The number of parameterspublic void setParameterQueryBNFId(java.lang.String parameterQueryBNFId)
parameterQueryBNFId
- The unique identifier of the JPQLQueryBNF
that will be used
to parse the arguments of the function expression