The abstract definition of a JPQLGrammar. The grammar defines how a JPQL query is parsed,
which is based on the BNF defined for that grammar.
Provisional 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 JPQLGrammar | jpqlGrammar
The base |
| private ExpressionRegistry | registry
The registry contains the |
| Access | Constructor and Description |
|---|---|
| protected | |
| protected | AbstractJPQLGrammar(AbstractJPQLGrammar
The jpqlGrammar)JPQLGrammar to extend with the content of this one without
instantiating the base JPQLGrammarCreates a new |
| Modifier and Type | Method and Description |
|---|---|
| public void | addChildBNF(String
The unique identifier of the parent BNF to add a child BNF queryBNFId, String The unique identifier of the child to add to the parent BNF childQueryBNFId)Adds to the given query BNF a child BNF. |
| public void | addChildFactory(String
The unique identifier of the parent BNF queryBNFId, String The unique identifier of the childExpressionFactoryId)ExpressionFactory to add
to the given query BNFAdds to the given unique identifier of an |
| public void | addIdentifier(String
The unique identifier of the expressionFactoryId, String ExpressionFactory to add more
JPQL identifiersThe JPQL identifier this factory will parse identifier)Adds the given JPQL identifier to this factory. |
| public void | addIdentifiers(String
The unique identifier of the expressionFactoryId, String... ExpressionFactory to add more
JPQL identifiersThe JPQL identifiers this factory will parse identifiers)Adds the given JPQL identifiers to this factory. |
| protected abstract JPQLGrammar | |
| protected ExpressionRegistry | buildExpressionRegistry()
Creates a new |
| public JPQLGrammar | |
| public ExpressionRegistry | getExpressionRegistry()
Implements org. JPQLQueryBNFs and the ExpressionFactories that are used
to properly parse a JPQL query.
|
| protected void | |
| private void | initialize(AbstractJPQLGrammar
The jpqlGrammar)JPQLGrammar to extend with the content of this one without
instantiating the base JPQLGrammarThis method simply retrieves the |
| protected abstract void | |
| protected abstract void | initializeExpressionFactories()
Registers the |
| protected abstract void | |
| protected void | |
| protected void | registerFactory(ExpressionFactory
The expressionFactory)ExpressionFactory to storeRegisters the given |
| protected void | registerIdentifierRole(String
The JPQL identifier to register its role within a JPQL query identifier, IdentifierRole The role of the given JPQL identifier role)Registers the |
| protected void | registerIdentifierVersion(String
The JPQL identifier to register in which version it was added to the grammar identifier, JPAVersion The version when the JPQL identifier was added to the grammar version)Registers the |
| public void | setFallbackBNFId(String
The unique identifier of the BNF to modify its fallback BNF unique identifier queryBNFId, 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 BNF to modify its fallback expression factory
unique identifier queryBNFId, String fallbackExpressionFactoryId)Sets the unique identifier of the |
| public void | setHandleCollection(String
The unique identifier of the queryBNFId, boolean JPQLQueryBNFtrue if the sub-expression to parse might have several
sub-expressions separated by commas; false otherwiseDetermines whether the |
| public void | setHandleNestedArray(String
The unique identifier of the queryBNFId, boolean JPQLQueryBNFtrue if the expression represented by this BNF can be
a nested array; false otherwiseSets whether the BNF with the given ID supports nested array or not. |
| public void | setHandleSubExpression(String
The unique identifier of the queryBNFId, boolean JPQLQueryBNFtrue 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 the query BNF with the given ID handles parsing a sub-expression, i.e. parsing an expression encapsulated by parenthesis. |
| jpqlGrammar | back to summary |
|---|---|
| private JPQLGrammar jpqlGrammar The base | |
| registry | back to summary |
|---|---|
| private ExpressionRegistry registry The registry contains the | |
| AbstractJPQLGrammar | back to summary |
|---|---|
| protected AbstractJPQLGrammar() Creates a new | |
| AbstractJPQLGrammar | back to summary |
|---|---|
| protected AbstractJPQLGrammar(AbstractJPQLGrammar jpqlGrammar) Creates a new
| |
| addChildBNF | back to summary |
|---|---|
| public void addChildBNF(String queryBNFId, String childQueryBNFId) Adds to the given query BNF a child BNF. | |
| addChildFactory | back to summary |
|---|---|
| public void addChildFactory(String queryBNFId, String childExpressionFactoryId) Adds to the given unique identifier of an
| |
| addIdentifier | back to summary |
|---|---|
| public void addIdentifier(String expressionFactoryId, String identifier) Adds the given JPQL identifier to this factory.
| |
| addIdentifiers | back to summary |
|---|---|
| public void addIdentifiers(String expressionFactoryId, String... identifiers) Adds the given JPQL identifiers to this factory.
| |
| buildBaseGrammar | back to summary |
|---|---|
| protected abstract JPQLGrammar buildBaseGrammar() Creates the base Important Note The singleton instance of any
| |
| buildExpressionRegistry | back to summary |
|---|---|
| protected ExpressionRegistry buildExpressionRegistry() Creates a new
| |
| getBaseGrammar | back to summary |
|---|---|
| public JPQLGrammar getBaseGrammar() Creates the base
| |
| getExpressionRegistry | back to summary |
|---|---|
| public ExpressionRegistry getExpressionRegistry() Implements org. Doc from org. Returns the registry containing the
| |
| initialize | back to summary |
|---|---|
| protected void initialize() Initializes this JPQL grammar. | |
| initialize | back to summary |
|---|---|
| private void initialize(AbstractJPQLGrammar jpqlGrammar) This method simply retrieves the
| |
| initializeBNFs | back to summary |
|---|---|
| protected abstract void initializeBNFs() Registers the JPQL query BNFs defining the JPQL grammar. | |
| initializeExpressionFactories | back to summary |
|---|---|
| protected abstract void initializeExpressionFactories() Registers the | |
| initializeIdentifiers | back to summary |
|---|---|
| protected abstract void initializeIdentifiers() Registers the JPQL identifiers support by this | |
| registerBNF | back to summary |
|---|---|
| protected void registerBNF(JPQLQueryBNF queryBNF) Registers the given
| |
| registerFactory | back to summary |
|---|---|
| protected void registerFactory(ExpressionFactory expressionFactory) Registers the given
| |
| registerIdentifierRole | back to summary |
|---|---|
| protected void registerIdentifierRole(String identifier, IdentifierRole role) Registers the
| |
| registerIdentifierVersion | back to summary |
|---|---|
| protected void registerIdentifierVersion(String identifier, JPAVersion version) Registers the
| |
| setFallbackBNFId | back to summary |
|---|---|
| public void setFallbackBNFId(String queryBNFId, String fallbackBNFId) When parsing the query and no
| |
| setFallbackExpressionFactoryId | back to summary |
|---|---|
| public void setFallbackExpressionFactoryId(String queryBNFId, String fallbackExpressionFactoryId) Sets the unique identifier of the Note This method is only called if
| |
| setHandleCollection | back to summary |
|---|---|
| public void setHandleCollection(String queryBNFId, boolean handleCollection) Determines whether the
| |
| setHandleNestedArray | back to summary |
|---|---|
| public void setHandleNestedArray(String queryBNFId, boolean handleNestedArray) Sets whether the BNF with the given ID 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(String queryBNFId, boolean handleSubExpression) Sets whether the query BNF with the given ID 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:
| |