JPQLGrammar given to JPQLExpression will give access to this registry.
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.
JPQLGrammar, ExpressionFactory, JPQLQueryBNF
| Modifier and Type | Field and Description |
|---|---|
| private Map | expressionFactories
The map of |
| private Map | identifiers
The set of the JPQL identifiers defined by the grammar. |
| private Map | identifierVersions
This table specify in which JPA version the identifiers was introduced. |
| private Map | queryBNFs
The |
| Access | Constructor and Description |
|---|---|
| public |
| 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. |
| public ExpressionFactory | expressionFactoryForIdentifier(String
The JPQL identifier for which its factory is searched identifier)Retrieves the |
| public ExpressionFactory | Returns: TheExpressionFactory mapped with the given unique identifierThe unique identifier of the expressionFactoryId)ExpressionFactory to retrieveRetrieves the registered |
| public IdentifierRole | Returns: TheIdentifierRole of the given JPQL identifierThe JPQL identifier for which its role is returned identifier)Retrieves the |
| public Set | Returns: The supported JPQL identifiersReturns the JPQL identifiers that are supported by the |
| public Iterable | Returns: The list of JPQL identifiers that are supported by a BNF ruleRetrieves the JPQL identifiers that are supported by the BNF rule with the given unique identifier. |
| public JPAVersion | Returns: The version in which the identifier was introducedRetrieves the JPA version in which the identifier was first introduced. |
| public JPQLQueryBNF | Returns: TheJPQLQueryBNF representing a section of the grammarThe unique identifier of the queryBNFId)JPQLQueryBNF to retrieveRetrieves the BNF object that was registered for the given unique identifier. |
| protected void | |
| public boolean | Returns: true if the word is an identifier, false otherwiseThe string value to test if it's a JPQL identifier based on what is registered
with this text)ExpressionRegistryDetermines if the given word is a JPQL identifier. |
| public void | |
| public void | registerFactory(ExpressionFactory
The expressionFactory)ExpressionFactory to storeRegisters the given |
| public 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 |
| public 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. |
| public void | unregisterBNF(JPQLQueryBNF
The queryBNF)JPQLQueryBNF to unregisterUnregisters the given |
| expressionFactories | back to summary |
|---|---|
| private Map<String, ExpressionFactory> expressionFactories The map of | |
| identifiers | back to summary |
|---|---|
| private Map<String, IdentifierRole> identifiers The set of the JPQL identifiers defined by the grammar. | |
| identifierVersions | back to summary |
|---|---|
| private Map<String, JPAVersion> identifierVersions This table specify in which JPA version the identifiers was introduced. | |
| queryBNFs | back to summary |
|---|---|
| private Map<String, JPQLQueryBNF> queryBNFs The | |
| ExpressionRegistry | back to summary |
|---|---|
| public ExpressionRegistry() Creates the only instance of | |
| 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.
| |
| expressionFactoryForIdentifier | back to summary |
|---|---|
| public ExpressionFactory expressionFactoryForIdentifier(String identifier) Retrieves the
| |
| getExpressionFactory | back to summary |
|---|---|
| public ExpressionFactory getExpressionFactory(String expressionFactoryId) Retrieves the registered
| |
| getIdentifierRole | back to summary |
|---|---|
| public IdentifierRole getIdentifierRole(String identifier) Retrieves the
| |
| getIdentifiers | back to summary |
|---|---|
| public Set Returns the JPQL identifiers that are supported by the | |
| getIdentifiers | back to summary |
|---|---|
| public Iterable Retrieves the JPQL identifiers that are supported by the BNF rule with the given unique
identifier. The JPQL identifiers are retrieved by scanning the | |
| getIdentifierVersion | back to summary |
|---|---|
| public JPAVersion getIdentifierVersion(String identifier) Retrieves the JPA version in which the identifier was first introduced.
| |
| getQueryBNF | back to summary |
|---|---|
| public JPQLQueryBNF getQueryBNF(String queryBNFId) Retrieves the BNF object that was registered for the given unique identifier.
| |
| initialize | back to summary |
|---|---|
| protected void initialize() Instantiates the only instance of various API used by the parser. | |
| isIdentifier | back to summary |
|---|---|
| public boolean isIdentifier(String text) Determines if the given word is a JPQL identifier. The check is case insensitive.
| |
| registerBNF | back to summary |
|---|---|
| public void registerBNF(JPQLQueryBNF queryBNF) Registers the given
| |
| registerFactory | back to summary |
|---|---|
| public void registerFactory(ExpressionFactory expressionFactory) Registers the given
| |
| registerIdentifierRole | back to summary |
|---|---|
| public void registerIdentifierRole(String identifier, IdentifierRole role) Registers the
| |
| registerIdentifierVersion | back to summary |
|---|---|
| public 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:
| |
| unregisterBNF | back to summary |
|---|---|
| public void unregisterBNF(JPQLQueryBNF queryBNF) Unregisters the given
| |