This defines a single Backus-Naur Form (BNF) of the JPQL grammar. The Java Persistence functional specifications are:
JPQLGrammar1_0: JSR 220: Enterprise JavaBeans™ version 3.0JPQLGrammar2_0: JSR 317: Java™ Persistence 2.0JPQLGrammar2_1: JSR 338: Java™ Persistence 2.1Provisional API: This interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.
| Modifier and Type | Field and Description |
|---|---|
| private Map | cachedExpressionFactories
Caches the |
| private String[] | cachedExpressionFactoryIds
Caches the collection of unique identifiers of the |
| private String[] | cachedIdentifiers
The list of JPQL identifiers that are known by this BNF rule and its children, they are
retrieved by scanning the list of |
| private JPQLQueryBNF[] | childQueryBNFs
Caches the children of this BNF rule (which actually includes this one as well). |
| private List | children
The children BNF of this one. |
| private boolean | compound
Determines whether this BNF has child BNFs registered only to properly parse a query or if the child BNFs are part of the BNF. |
| private List | expressionFactoryIds
The list of unique identifiers for the |
| private ExpressionRegistry | expressionRegistry
The |
| private String | fallbackBNFId
The unique identifier of the |
| private String | fallbackExpressionFactoryId
The unique identifier of the |
| private Boolean | handleAggregate
Caches the property since any BNF rule is static. |
| private Boolean | handleCollection
Caches the property since any BNF rule is static. |
| private boolean | handleNestedArray
Determines whether this BNF handles parsing a nested array or not. |
| private boolean | handleSubExpression
This flag can be used to determine if this BNF handles parsing a sub-expression, i.e. an expression encapsulated by parenthesis. |
| private String | id
The unique identifier of this BNF rule. |
| private JPQLQueryBNF[] | nonCompoundChildren
Caches the children of this BNF rule (which actually includes this one as well) but do not includes BNF rules that are used for compounding a rule. |
| private static final Filter | nonCompoundFilter
Only keep one instance of the |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| private void | addChildren(Set<JPQLQueryBNF>
The set to add the child BNF rules queryBNFs, Filter<JPQLQueryBNF> The filter)Filter determines if the children of a given BNF should be addedAdds to the given set the child BNF rules and requests them to add their children as long as they have not been traversed already. |
| private JPQLQueryBNF[] | |
| private static Filter | |
| private void | |
| private void | |
| private boolean | |
| private boolean | |
| public Iterable | Returns: The children BNFs describing this BNF ruleReturns the set of all the query BNFs that are part of this BNF. |
| private JPQLQueryBNF[] | |
| public ExpressionFactory | Returns: TheExpressionFactory responsible to parse a portion of the query starting
with the given identifier; null if nothing was registered for itThe JPQL identifier (in theory) that is used to retrieve the factory
responsible to parse a portion of the query starting with that identifier identifier)Retrieves the |
| public Iterable | Returns: The list of unique identifiers of theExpressionFactory registered with this
BNF rule and with its childrenReturns the unique identifiers of the |
| private String[] | |
| public ExpressionRegistry | Returns: The registry containing the information related to the JPQL grammarReturns the registry containing the |
| public String | Returns: The unique identifier of theJPQLQueryBNF to use in the last resortWhen parsing the query and no |
| public String | Returns: The unique identifier of theExpressionFactoryReturns the unique identifier of the |
| public String | |
| public Iterable | Returns: The list of JPQL identifiers that are supported by this BNFRetrieves the JPQL identifiers that are supported by this BNF rule. |
| public boolean | Returns: true if the sub-expression to parse might have several logical and/or
arithmetic expressions; false otherwiseDetermines whether the |
| public boolean | Returns: true if the sub-expression to parse might have several sub-expressions
separated by commas; false otherwiseDetermines whether the |
| public boolean | |
| public boolean | Returns: true if this BNF handles parsing a sub-expression; false otherwiseDetermines whether this BNF handles parsing a sub-expression, i.e. parsing an expression encapsulated by parenthesis. |
| public boolean | |
| public boolean | Returns: true if the given word is a JPQL identifier and it is supported by this
BNF; false otherwiseA word that could be a JPQL identifier or anything else word)Determines if this query BNF support the given word, which can be an identifier. |
| protected void | |
| private void | |
| public boolean | Returns: false by defaultDetermines whether this BNF has child BNFs registered only to properly parse a query or if the child BNFs are part of the BNF. |
| public Iterable | Returns: The children BNFs describing this BNF rule. The set excludes BNF rules that are used to complete a BNF, such as the BNF rules defined for BETWEEN since they are required to properly parse the queryReturns the set of all the query BNFs that are part of this BNF. |
| protected final void | registerChild(String
The unique identifier of the BNF rule to add as a child queryBNFId)Registers the unique identifier of the BNF rule as a child of this BNF rule. |
| protected final void | registerExpressionFactory(String
The unique identifier of the expressionFactoryId)ExpressionFactoryRegisters a unique identifier of the |
| public void | setCompound(boolean
true if this BNF represents a compound BNF and its children are
not part of this BNF but only to support compound expression; false otherwiseDetermines whether this BNF has child BNFs registered only to properly parse a query or if the child BNFs are part of the BNF. |
| pack-priv final void | setExpressionRegistry(ExpressionRegistry
The registry for a given JPQL grammar expressionRegistry)Sets the backpointer to the |
| public void | setFallbackBNFId(String
The unique identifier of the fallbackBNFId)JPQLQueryBNF to use in the last resortWhen parsing the query and no |
| public void | setFallbackExpressionFactoryId(String
The unique identifier of the fallbackExpressionFactoryId)ExpressionFactorySets the unique identifier of the |
| public void | setHandleAggregate(boolean
true if the sub-expression to parse might have several
logical and/or arithmetic expressions; false otherwiseSets whether the |
| public void | setHandleCollection(boolean
true if the sub-expression to parse might have several
sub-expressions separated by commas; false otherwiseSets whether the |
| public void | setHandleNestedArray(boolean
true if the expression represented by this BNF can be
a nested array; false otherwiseSets whether this BNF supports nested array or not. |
| public void | setHandleSubExpression(boolean
true to let the creation of a sub-expression be
created by the fallback ExpressionFactory registered with this BNF; false
otherwise (which is the default value)Sets whether this BNF handles parsing a sub-expression, i.e. parsing an expression encapsulated by parenthesis. |
| public String | |
| protected void | toString(StringBuilder
The builder used to add information about this class sb)Adds to the given builder more information about this |
| cachedExpressionFactories | back to summary |
|---|---|
| private Map<String, ExpressionFactory> cachedExpressionFactories Caches the | |
| cachedExpressionFactoryIds | back to summary |
|---|---|
| private String[] cachedExpressionFactoryIds Caches the collection of unique identifiers of the | |
| cachedIdentifiers | back to summary |
|---|---|
| private String[] cachedIdentifiers The list of JPQL identifiers that are known by this BNF rule and its children, they are
retrieved by scanning the list of | |
| childQueryBNFs | back to summary |
|---|---|
| private JPQLQueryBNF[] childQueryBNFs Caches the children of this BNF rule (which actually includes this one as well). | |
| children | back to summary |
|---|---|
| private List<String> children The children BNF of this one. | |
| compound | back to summary |
|---|---|
| private boolean compound Determines whether this BNF has child BNFs registered only to properly parse a query or if the
child BNFs are part of the BNF. An example if a compound BNF is | |
| expressionFactoryIds | back to summary |
|---|---|
| private List<String> expressionFactoryIds The list of unique identifiers for the | |
| expressionRegistry | back to summary |
|---|---|
| private ExpressionRegistry expressionRegistry The | |
| fallbackBNFId | back to summary |
|---|---|
| private String fallbackBNFId The unique identifier of the | |
| fallbackExpressionFactoryId | back to summary |
|---|---|
| private String fallbackExpressionFactoryId The unique identifier of the | |
| handleAggregate | back to summary |
|---|---|
| private Boolean handleAggregate Caches the property since any BNF rule is static. | |
| handleCollection | back to summary |
|---|---|
| private Boolean handleCollection Caches the property since any BNF rule is static. | |
| handleNestedArray | back to summary |
|---|---|
| private boolean handleNestedArray Determines whether this BNF handles parsing a nested array or not. | |
| handleSubExpression | back to summary |
|---|---|
| private boolean handleSubExpression This flag can be used to determine if this BNF handles parsing a sub-expression, i.e. an
expression encapsulated by parenthesis. See | |
| id | back to summary |
|---|---|
| private String id The unique identifier of this BNF rule. | |
| nonCompoundChildren | back to summary |
|---|---|
| private JPQLQueryBNF[] nonCompoundChildren Caches the children of this BNF rule (which actually includes this one as well) but do not includes BNF rules that are used for compounding a rule. | |
| nonCompoundFilter | back to summary |
|---|---|
| private static final Filter<JPQLQueryBNF> nonCompoundFilter Only keep one instance of the | |
| JPQLQueryBNF | back to summary |
|---|---|
| protected JPQLQueryBNF(String id) Creates a new
| |
| addChildren | back to summary |
|---|---|
| private void addChildren(Set<JPQLQueryBNF> queryBNFs, Filter<JPQLQueryBNF> filter) Adds to the given set the child BNF rules and requests them to add their children as long as they have not been traversed already.
| |
| buildChildren | back to summary |
|---|---|
| private JPQLQueryBNF[] buildChildren(Filter<JPQLQueryBNF> filter) | |
| buildNonCompoundFilter | back to summary |
|---|---|
| private static Filter | |
| calculateExpressionFactories | back to summary |
|---|---|
| private void calculateExpressionFactories() | |
| calculateExpressionFactoryIds | back to summary |
|---|---|
| private void calculateExpressionFactoryIds(Set<JPQLQueryBNF> queryBNFs, Set<String> factoryIds) | |
| calculateHandleAggregate | back to summary |
|---|---|
| private boolean calculateHandleAggregate(Set<JPQLQueryBNF> queryBNFs) | |
| calculateHandleCollection | back to summary |
|---|---|
| private boolean calculateHandleCollection(Set<JPQLQueryBNF> queryBNFs) | |
| children | back to summary |
|---|---|
| public Iterable Returns the set of all the query BNFs that are part of this BNF. The set always include this BNF as well.
| |
| getChildren | back to summary |
|---|---|
| private JPQLQueryBNF[] getChildren() | |
| getExpressionFactory | back to summary |
|---|---|
| public ExpressionFactory getExpressionFactory(String identifier) Retrieves the
| |
| getExpressionFactoryIds | back to summary |
|---|---|
| public Iterable Returns the unique identifiers of the
| |
| getExpressionFactoryIdsImp | back to summary |
|---|---|
| private String[] getExpressionFactoryIdsImp() | |
| getExpressionRegistry | back to summary |
|---|---|
| public ExpressionRegistry getExpressionRegistry() Returns the registry containing the
| |
| getFallbackBNFId | back to summary |
|---|---|
| public String getFallbackBNFId() When parsing the query and no
| |
| getFallbackExpressionFactoryId | back to summary |
|---|---|
| public String getFallbackExpressionFactoryId() Returns the unique identifier of the Note This method is only called if
| |
| getId | back to summary |
|---|---|
| public String getId() Returns the unique identifier of this
| |
| getIdentifiers | back to summary |
|---|---|
| public Iterable Retrieves the JPQL identifiers that are supported by this BNF rule. The JPQL identifiers are
retrieved by scanning the | |
| handleAggregate | back to summary |
|---|---|
| public boolean handleAggregate() Determines whether the
| |
| handleCollection | back to summary |
|---|---|
| public boolean handleCollection() Determines whether the
| |
| handlesNestedArray | back to summary |
|---|---|
public boolean handlesNestedArray()
| |
| handleSubExpression | back to summary |
|---|---|
| public boolean handleSubExpression() Determines whether this BNF handles parsing a sub-expression, i.e. parsing an expression
encapsulated by parenthesis. See
| |
| hasChild | back to summary |
|---|---|
| public boolean hasChild(String queryBNFId) Determines whether the BNF with the given ID is part of this BNF or not.
| |
| hasIdentifier | back to summary |
|---|---|
| public boolean hasIdentifier(String word) Determines if this query BNF support the given word, which can be an identifier.
| |
| initialize | back to summary |
|---|---|
| protected void initialize() Initializes this BNF by registering child | |
| initialize | back to summary |
|---|---|
| private void initialize(String id) Initializes this
| |
| isCompound | back to summary |
|---|---|
| public boolean isCompound() Determines whether this BNF has child BNFs registered only to properly parse a query or if the
child BNFs are part of the BNF. An example if a compound BNF is
| |
| nonCompoundChildren | back to summary |
|---|---|
| public Iterable Returns the set of all the query BNFs that are part of this BNF. The set always include this BNF as well.
| |
| registerChild | back to summary |
|---|---|
| protected final void registerChild(String queryBNFId) Registers the unique identifier of the BNF rule as a child of this BNF rule.
| |
| registerExpressionFactory | back to summary |
|---|---|
| protected final void registerExpressionFactory(String expressionFactoryId) Registers a unique identifier of the
| |
| setCompound | back to summary |
|---|---|
| public void setCompound(boolean compound) Determines whether this BNF has child BNFs registered only to properly parse a query or if the
child BNFs are part of the BNF. An example if a compound BNF is
| |
| setExpressionRegistry | back to summary |
|---|---|
| pack-priv final void setExpressionRegistry(ExpressionRegistry expressionRegistry) Sets the backpointer to the
| |
| setFallbackBNFId | back to summary |
|---|---|
| public void setFallbackBNFId(String fallbackBNFId) When parsing the query and no
| |
| setFallbackExpressionFactoryId | back to summary |
|---|---|
| public void setFallbackExpressionFactoryId(String fallbackExpressionFactoryId) Sets the unique identifier of the Note This method is only called if
| |
| setHandleAggregate | back to summary |
|---|---|
| public void setHandleAggregate(boolean handleAggregate) Sets whether the
| |
| setHandleCollection | back to summary |
|---|---|
| public void setHandleCollection(boolean handleCollection) Sets whether the
| |
| setHandleNestedArray | back to summary |
|---|---|
| public void setHandleNestedArray(boolean handleNestedArray) Sets whether this BNF supports nested array or not. A nested array is a sub-expression with its child being a collection expression: (item_1, item_2, ..., item_n).
| |
| setHandleSubExpression | back to summary |
|---|---|
| public void setHandleSubExpression(boolean handleSubExpression) Sets whether this BNF handles parsing a sub-expression, i.e. parsing an expression
encapsulated by parenthesis. Which in fact would be handled by the fallback
A good example for using this option is when an
Let's say we want to parse "SELECT e FROM (SELECT a FROM Address a) e",
In order to get this working, the following would have to be done into the grammar:
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| toString | back to summary |
|---|---|
| protected void toString(StringBuilder sb) Adds to the given builder more information about this
| |