| 
 | EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.eclipse.persistence.jpa.jpql.parser.JPQLQueryBNF
public abstract class JPQLQueryBNF
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.0
 
 JPQLGrammar2_0: JSR 317: Java™ Persistence 2.0
 
 JPQLGrammar2_1: JSR 338: Java™ Persistence 2.1
 
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.
| Constructor Summary | |
|---|---|
| protected  | JPQLQueryBNF(java.lang.String id)Creates a new JPQLQueryBNF. | 
| Method Summary | |
|---|---|
|  java.lang.Iterable<JPQLQueryBNF> | children()Returns the set of all the query BNFs that are part of this BNF. | 
|  ExpressionFactory | getExpressionFactory(java.lang.String identifier)Retrieves the ExpressionFactorythat is associated with the given identifier, if the
 given string is indeed a JPQL identifier. | 
|  java.lang.Iterable<java.lang.String> | getExpressionFactoryIds()Returns the unique identifiers of the ExpressionFactoryhandled by this BNF rule,
 which includes those from the children as well. | 
|  ExpressionRegistry | getExpressionRegistry()Returns the registry containing the JPQLQueryBNFsand theExpressionFactoriesthat are used
 to properly parse a JPQL query. | 
|  java.lang.String | getFallbackBNFId()When parsing the query and no JPQLQueryBNFscan help to parse the query,
 then it will fall back on this one. | 
|  java.lang.String | getFallbackExpressionFactoryId()Returns the unique identifier of the ExpressionFactoryto use when the fall back BNF
 ID is notnull. | 
|  java.lang.String | getId()Returns the unique identifier of this JPQLQueryBNF. | 
|  java.lang.Iterable<java.lang.String> | getIdentifiers()Retrieves the JPQL identifiers that are supported by this BNF rule. | 
|  boolean | handleAggregate()Determines whether the Expressionhandles a collection of sub-expressions that
 are aggregated by logical or arithmetic operators. | 
|  boolean | handleCollection()Determines whether the Expressionhandles a collection of sub-expressions that
 are separated by commas. | 
|  boolean | handlesSubExpression()Determines whether this BNF handles parsing a sub-expression, i.e. parsing an expression encapsulated by parenthesis. | 
|  boolean | hasIdentifier(java.lang.String word)Determines if this query BNF support the given word, which can be an identifier. | 
| protected  void | initialize()Initializes this BNF by registering child JPQLQueryBNFsandExpressionFactories. | 
|  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. | 
|  java.lang.Iterable<JPQLQueryBNF> | nonCompoundChildren()Returns the set of all the query BNFs that are part of this BNF. | 
| protected  void | registerChild(java.lang.String queryBNFId)Registers the unique identifier of the BNF rule as a child of this BNF rule. | 
| protected  void | registerExpressionFactory(java.lang.String expressionFactoryId)Registers a unique identifier of the ExpressionFactoryto register with this BNF rule. | 
|  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. | 
|  void | setFallbackBNFId(java.lang.String fallbackBNFId)When parsing the query and no JPQLQueryBNFscan help to parse the query,
 then it will fall back on the given one. | 
|  void | setFallbackExpressionFactoryId(java.lang.String fallbackExpressionFactoryId)Sets the unique identifier of the ExpressionFactoryto use when the fall back BNF
 ID is notnull. | 
|  void | setHandleAggregate(boolean handleAggregate)Sets whether the Expressionhandles a collection of sub-expressions that are
 aggregated by logical or arithmetic operators. | 
|  void | setHandleCollection(boolean handleCollection)Sets whether the Expressionhandles a collection of sub-expressions that are
 separated by commas. | 
|  void | setHandleSubExpression(boolean handleSubExpression)Sets whether this BNF handles parsing a sub-expression, i.e. parsing an expression encapsulated by parenthesis. | 
|  java.lang.String | toString() | 
| protected  void | toString(java.lang.StringBuilder sb)Adds to the given builder more information about this JPQLQueryBNF. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
protected JPQLQueryBNF(java.lang.String id)
JPQLQueryBNF.
id - The unique identifier of this BNF rule
java.lang.NullPointerException - The given unique identifier cannot be null| Method Detail | 
|---|
public java.lang.Iterable<JPQLQueryBNF> children()
public ExpressionFactory getExpressionFactory(java.lang.String identifier)
ExpressionFactory that is associated with the given identifier, if the
 given string is indeed a JPQL identifier.
identifier - The JPQL identifier (in theory) that is used to retrieve the factory
 responsible to parse a portion of the query starting with that identifier
ExpressionFactory responsible to parse a portion of the query starting
 with the given identifier; null if nothing was registered for itpublic java.lang.Iterable<java.lang.String> getExpressionFactoryIds()
ExpressionFactory handled by this BNF rule,
 which includes those from the children as well.
ExpressionFactory registered with this
 BNF rule and with its childrenpublic ExpressionRegistry getExpressionRegistry()
JPQLQueryBNFs and the ExpressionFactories that are used
 to properly parse a JPQL query.
public java.lang.String getFallbackBNFId()
JPQLQueryBNFs can help to parse the query,
 then it will fall back on this one.
JPQLQueryBNF to use in the last resortpublic java.lang.String getFallbackExpressionFactoryId()
ExpressionFactory to use when the fall back BNF
 ID is not null. This will be used to parse a portion of the query when the
 registered expression factories cannot parse it.
 
 Note: This method is only called if getFallbackBNFId() does not return null.
ExpressionFactorypublic java.lang.String getId()
JPQLQueryBNF.
JPQLQueryBNF with AbstractExpressionpublic java.lang.Iterable<java.lang.String> getIdentifiers()
ExpressionFactory registered with this BNF rule and the
 child BNF rules.
public boolean handleAggregate()
Expression handles a collection of sub-expressions that
 are aggregated by logical or arithmetic operators.
true if the sub-expression to parse might have several logical and/or
 arithmetic expressions; false otherwisepublic boolean handleCollection()
Expression handles a collection of sub-expressions that
 are separated by commas.
true if the sub-expression to parse might have several sub-expressions
 separated by commas; false otherwisepublic boolean handlesSubExpression()
setHandleSubExpression(boolean) for more details.
true if this BNF handles parsing a sub-expression; false otherwisepublic boolean hasIdentifier(java.lang.String word)
word - A word that could be a JPQL identifier or anything else
true if the given word is a JPQL identifier and it is supported by this
 BNF; false otherwiseprotected void initialize()
JPQLQueryBNFs and ExpressionFactories.
public boolean isCompound()
BetweenExpressionBNF,
 it registers a series of children BNFs but they shouldn't be used to determine if they are
 part of that BNF since the comparator identifiers are.
false by defaultpublic java.lang.Iterable<JPQLQueryBNF> nonCompoundChildren()
protected final void registerChild(java.lang.String queryBNFId)
queryBNFId - The unique identifier of the BNF rule to add as a child
java.lang.NullPointerException - The queryBNFId cannot be nullprotected final void registerExpressionFactory(java.lang.String expressionFactoryId)
ExpressionFactory to register with this BNF rule.
expressionFactoryId - The unique identifier of the ExpressionFactory
java.lang.NullPointerException - The expressionFactoryId cannot be nullpublic void setCompound(boolean compound)
BetweenExpressionBNF,
 it registers a series of children BNFs but they shouldn't be used to determine if they are
 part of that BNF since the comparator identifiers are.
compound - true if this BNF represents a compound BNF and its children are
 not part of this BNF but only to support compound expression; false otherwisepublic void setFallbackBNFId(java.lang.String fallbackBNFId)
JPQLQueryBNFs can help to parse the query,
 then it will fall back on the given one.
fallbackBNFId - The unique identifier of the JPQLQueryBNF to use in the last resortpublic void setFallbackExpressionFactoryId(java.lang.String fallbackExpressionFactoryId)
ExpressionFactory to use when the fall back BNF
 ID is not null. This will be used to parse a portion of the query when the
 registered expression factories cannot parse it.
 
 Note: This method is only called if getFallbackBNFId() does not return null.
fallbackExpressionFactoryId - The unique identifier of the ExpressionFactorypublic void setHandleAggregate(boolean handleAggregate)
Expression handles a collection of sub-expressions that are
 aggregated by logical or arithmetic operators.
handleAggregate - true if the sub-expression to parse might have several
 logical and/or arithmetic expressions; false otherwisepublic void setHandleCollection(boolean handleCollection)
Expression handles a collection of sub-expressions that are
 separated by commas.
handleCollection - true if the sub-expression to parse might have several
 sub-expressions separated by commas; false otherwisepublic void setHandleSubExpression(boolean handleSubExpression)
ExpressionFactory. The default behavior is to not handle it.
 
 A good example for using this option is when an Expression cannot use any ExpressionFactory for creating a child object, parsing will use the fallback ExpressionFactory, if one was specified. So when this is set to true, the
 fallback ExpressionFactory will be immediately invoked.
 
 Let's say we want to parse "SELECT e FROM (SELECT a FROM Address a) e", FromClause
 cannot use a factory for parsing the entity name (that's what usually the FROM
 clause has) so it uses the fallback factory to create IdentificationVariableDeclaration.
 Then IdentificationVariableDeclaration also cannot use any factory to create its
 child object so it uses the fallback factory to create RangeVariableDeclaration.
 By changing the status of for handling the sub-expression for the BNFs for those objects, then
 a subquery can be created by RangeVariableDeclaration.
 
FromClause
  |- IdentificationVariableDeclaration
       |- RangeVariableDeclaration
            |- SubExpression(subquery) public class MyJPQLGrammar extends AbstractJPQLGrammar {
   @Override
   protected void initializeBNFs() {
      setHandleSubExpression(InternalFromClauseBNF.ID,                true);
      setHandleSubExpression(InternalSimpleFromClauseBNF.ID,          true);
      setHandleSubExpression(IdentificationVariableDeclarationBNF.ID, true);
      setHandleSubExpression(RangeVariableDeclarationBNF.ID,          true);
   }
 }
handleSubExpression - 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)public java.lang.String toString()
toString in class java.lang.Objectprotected void toString(java.lang.StringBuilder sb)
JPQLQueryBNF.
sb - The builder used to add information about this class| 
 | EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||