Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

E28847-01


org.eclipse.persistence.jpa.internal.jpql.parser
Class JPQLQueryBNF

java.lang.Object
  extended by org.eclipse.persistence.jpa.internal.jpql.parser.JPQLQueryBNF

Direct Known Subclasses:
AbstractSchemaNameBNF, AggregateExpressionBNF, AllOrAnyExpressionBNF, ArithmeticExpressionBNF, ArithmeticFactorBNF, ArithmeticPrimaryBNF, ArithmeticTermBNF, BadExpressionBNF, BetweenExpressionBNF, BooleanExpressionBNF, BooleanLiteralBNF, BooleanPrimaryBNF, CaseExpressionBNF, CaseOperandBNF, CoalesceExpressionBNF, CollectionMemberDeclarationBNF, CollectionMemberExpressionBNF, CollectionValuedPathExpressionBNF, ComparisonExpressionBNF, ConditionalExpressionBNF, ConditionalFactorBNF, ConditionalPrimaryBNF, ConditionalTermBNF, ConstructorExpressionBNF, ConstructorItemBNF, DatetimeExpressionBNF, DateTimePrimaryBNF, DateTimeTimestampLiteralBNF, DeleteClauseBNF, DeleteClauseRangeVariableDeclarationBNF, DeleteStatementBNF, DerivedCollectionMemberDeclarationBNF, ElseExpressionBNF, EmptyCollectionComparisonExpressionBNF, EntityExpressionBNF, EntityOrValueExpressionBNF, EntityTypeExpressionBNF, EntityTypeLiteralBNF, EnumExpressionBNF, EnumLiteralBNF, EnumPrimaryBNF, ExistsExpressionBNF, FromClauseBNF, FuncExpressionBNF, FuncItemBNF, FunctionsReturningDatetimeBNF, FunctionsReturningNumericsBNF, FunctionsReturningStringsBNF, GeneralCaseExpressionBNF, GeneralIdentificationVariableBNF, GroupByClauseBNF, GroupByItemBNF, HavingClauseBNF, IdentificationVariableBNF, IdentificationVariableDeclarationBNF, InExpressionBNF, InExpressionExpressionBNF, InItemBNF, InputParameterBNF, InternalBetweenExpressionBNF, InternalCoalesceExpressionBNF, InternalConcatExpressionBNF, InternalCountBNF, InternalEntityTypeExpressionBNF, InternalFromClauseBNF, InternalJoinBNF, InternalOrderByClauseBNF, InternalOrderByItemBNF, InternalSimpleFromClauseBNF, InternalUpdateClauseBNF, InternalWhenClauseBNF, JoinAssociationPathExpressionBNF, JoinBNF, JoinFetchBNF, JPQLStatementBNF, LikeExpressionBNF, LiteralBNF, NewValueBNF, NullComparisonExpressionBNF, NullIfExpressionBNF, NumericLiteralBNF, ObjectExpressionBNF, OrderByClauseBNF, OrderByItemBNF, PatternValueBNF, PreLiteralExpressionBNF, QualifiedIdentificationVariableBNF, RangeVariableDeclarationBNF, ResultVariableBNF, ScalarExpressionBNF, SelectClauseBNF, SelectExpressionBNF, SelectItemBNF, SelectStatementBNF, SimpleArithmeticExpressionBNF, SimpleCaseExpressionBNF, SimpleConditionalExpressionBNF, SimpleEntityExpressionBNF, SimpleEntityOrValueExpressionBNF, SimpleSelectClauseBNF, SimpleSelectExpressionBNF, SingleValuedObjectPathExpressionBNF, SingleValuedPathExpressionBNF, StateFieldPathExpressionBNF, StringExpressionBNF, StringLiteralBNF, StringPrimaryBNF, SubQueryBNF, SubQueryFromClauseBNF, SubSelectIdentificationVariableDeclarationBNF, TreatExpressionBNF, TypeExpressionBNF, UpdateClauseBNF, UpdateItemBNF, UpdateItemStateFieldPathExpressionBNF, UpdateStatementBNF, WhenClauseBNF, WhereClauseBNF

public abstract class JPQLQueryBNF
extends java.lang.Object

This defines the Backus-Naur Form (BNF) of the JSR 317: Java™ Persistence 2.0.

Since:
2.3
Version:
2.3
Author:
Pascal Filion
See Also:
Expression for the complete grammar

Field Summary
private  java.util.Set<java.lang.String> cachedFactories
          Caches the collection of unique identifiers matching the expression factories since any BNF rule is static.
private  java.util.Map<java.lang.String,ExpressionFactory> cachedIdentifiers
          Caches the identifier retrieves from all the expression factories.
private  java.util.Set<JPQLQueryBNF> childNonCompoundQueryBNFs
          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  java.util.Set<JPQLQueryBNF> childQueryBNFs
          Caches the children of this BNF rule (which actually includes this one as well).
private  java.util.List<java.lang.String> children
          The children BNF of this one.
private  java.util.List<java.lang.String> expressionFactories
          The list of identifiers that are part of the this BNF rule.
private  java.lang.Boolean handleAggregate
          Caches the property since any BNF rule is static.
private  java.lang.Boolean handleCollection
          Caches the property since any BNF rule is static.
private  java.lang.String id
          The unique identifier of this BNF rule.
private  boolean traversed
          This flag is used to prevent cyclical loop when retrieving some properties from the child BNF rules.

 

Constructor Summary
JPQLQueryBNF(java.lang.String id)
          Creates a new JPQLQueryBNF.

 

Method Summary
(package private)  void addChildren(java.util.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.
private  java.util.Set<JPQLQueryBNF> buildChildren(Filter<JPQLQueryBNF> filter)
           
private  java.util.Map<java.lang.String,ExpressionFactory> buildIdentifiers()
           
private  Filter<JPQLQueryBNF> buildNonCompoundFilter()
           
private  boolean calculateHandleAggregate()
           
private  boolean calculateHandleCollection()
           
(package private)  java.util.Set<JPQLQueryBNF> children()
          Returns the set of all the query BNFs that are part of this BNF.
 ExpressionFactory expressionFactory(java.lang.String identifier)
          Retrieves the ExpressionFactory that is associated with the given identifier, if the given string is indeed a JPQL identifier.
 java.util.Set<java.lang.String> expressionFactoryIds()
          Returns the unique identifiers of the expression factories handled by this BNF rule.
(package private)  java.lang.String getFallbackBNFId()
          When parsing the query and no JPQLQueryBNFs can help to parse the query, then it will fall back on this one.
(package private)  java.lang.String getFallbackExpressionFactoryId()
          Returns the unique identifier of the ExpressionFactory to use when the fall back BNF ID is not null.
 java.lang.String getId()
          Returns the unique identifier of this JPQLQueryBNF.
 boolean handleAggregate()
          Determines whether the Expression handles a collection of sub-expressions that are aggregated by logical or arithmetic operators.
 boolean handleCollection()
          Determines whether the Expression handles a collection of sub-expressions that are separated by commas.
 boolean hasIdentifier(java.lang.String word)
          Determines if this query BNF support the given word, which can be an identifier.
 java.lang.Iterable<java.lang.String> identifiers()
          Retrieves the identifiers that are supported by this BNF.
(package private)  void initialize()
          Initializes this BNF rule by registering child BNF rules and expression factories.
 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.util.Set<JPQLQueryBNF> nonCompoundChildren()
          Returns the set of all the query BNFs that are part of this BNF.
private  void populateIdentifiers()
           
private  JPQLQueryBNF queryBNF(java.lang.String id)
           
(package private)  void registerChild(java.lang.String queryBNF)
          Registers the unique identifier of the BNF rule as a child of this BNF rule.
(package private)  void registerExpressionFactory(java.lang.String expressionFactory)
          Registers a unique identifier that will be used to create the {@link Expression representing this BNF rule.
 java.lang.String toString()
          

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Field Detail

cachedFactories

private java.util.Set<java.lang.String> cachedFactories
Caches the collection of unique identifiers matching the expression factories since any BNF rule is static.

cachedIdentifiers

private java.util.Map<java.lang.String,ExpressionFactory> cachedIdentifiers
Caches the identifier retrieves from all the expression factories.

childNonCompoundQueryBNFs

private java.util.Set<JPQLQueryBNF> childNonCompoundQueryBNFs
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.

childQueryBNFs

private java.util.Set<JPQLQueryBNF> childQueryBNFs
Caches the children of this BNF rule (which actually includes this one as well).

children

private java.util.List<java.lang.String> children
The children BNF of this one.

expressionFactories

private java.util.List<java.lang.String> expressionFactories
The list of identifiers that are part of the this BNF rule.

handleAggregate

private java.lang.Boolean handleAggregate
Caches the property since any BNF rule is static.

handleCollection

private java.lang.Boolean handleCollection
Caches the property since any BNF rule is static.

id

private java.lang.String id
The unique identifier of this BNF rule.

traversed

private boolean traversed
This flag is used to prevent cyclical loop when retrieving some properties from the child BNF rules.

Constructor Detail

JPQLQueryBNF

JPQLQueryBNF(java.lang.String id)
Creates a new JPQLQueryBNF.
Parameters:
id - The unique identifier of this BNF rule

Method Detail

addChildren

void addChildren(java.util.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.
Parameters:
queryBNFs - The set to add the child BNF rules
filter - The Filter determines if the children of a given BNF should be added

buildChildren

private java.util.Set<JPQLQueryBNF> buildChildren(Filter<JPQLQueryBNF> filter)

buildIdentifiers

private java.util.Map<java.lang.String,ExpressionFactory> buildIdentifiers()

buildNonCompoundFilter

private Filter<JPQLQueryBNF> buildNonCompoundFilter()

calculateHandleAggregate

private boolean calculateHandleAggregate()

calculateHandleCollection

private boolean calculateHandleCollection()

children

final java.util.Set<JPQLQueryBNF> children()
Returns the set of all the query BNFs that are part of this BNF. The set always include this BNF as well.
Returns:
The children BNFs describing this BNF rule

expressionFactory

public final ExpressionFactory expressionFactory(java.lang.String identifier)
Retrieves the ExpressionFactory that is associated with the given identifier, if the given string is indeed a JPQL identifier.
Parameters:
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
Returns:
The ExpressionFactory responsible to parse a portion of the query starting with the given identifier; null if nothing was registered for it

expressionFactoryIds

public final java.util.Set<java.lang.String> expressionFactoryIds()
Returns the unique identifiers of the expression factories handled by this BNF rule.
Returns:
The list of unique identifiers for each ExpressionFactory

getFallbackBNFId

java.lang.String getFallbackBNFId()
When parsing the query and no JPQLQueryBNFs can help to parse the query, then it will fall back on this one.
Returns:
The unique identifier of the JPQLQueryBNF to use in the last resort

getFallbackExpressionFactoryId

java.lang.String getFallbackExpressionFactoryId()
Returns the unique identifier of the 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.

Returns:
The unique identifier of the ExpressionFactory

getId

public final java.lang.String getId()
Returns the unique identifier of this JPQLQueryBNF.
Returns:
The identifier used to register this JPQLQueryBNF with AbstractExpression

handleAggregate

public boolean handleAggregate()
Determines whether the Expression handles a collection of sub-expressions that are aggregated by logical or arithmetic operators.
Returns:
true if the sub-expression to parse might have several logical and/or arithmetic expressions; false otherwise

handleCollection

public boolean handleCollection()
Determines whether the Expression handles a collection of sub-expressions that are separated by commas.
Returns:
true if the sub-expression to parse might have several sub-expressions separated by commas; false otherwise

hasIdentifier

public final boolean hasIdentifier(java.lang.String word)
Determines if this query BNF support the given word, which can be an identifier.
Parameters:
word - A word that could be a JPQL identifier or anything else
Returns:
true if the given word is a JPQL identifier and it is supported by this BNF; false otherwise

identifiers

public final java.lang.Iterable<java.lang.String> identifiers()
Retrieves the identifiers that are supported by this BNF.
Returns:
The list of JPQL identifiers that are supported by this BNF

initialize

void initialize()
Initializes this BNF rule by registering child BNF rules and expression factories.

isCompound

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 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.
Returns:
false by default

nonCompoundChildren

public final java.util.Set<JPQLQueryBNF> nonCompoundChildren()
Returns the set of all the query BNFs that are part of this BNF. The set always include this BNF as well.
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 query

populateIdentifiers

private void populateIdentifiers()

queryBNF

private JPQLQueryBNF queryBNF(java.lang.String id)

registerChild

final void registerChild(java.lang.String queryBNF)
Registers the unique identifier of the BNF rule as a child of this BNF rule.
Parameters:
queryBNF - The unique identifier of the BNF rule

registerExpressionFactory

final void registerExpressionFactory(java.lang.String expressionFactory)
Registers a unique identifier that will be used to create the {@link Expression representing this BNF rule.
Parameters:
expressionFactory - The unique identifier that is responsible to create the Expression for this BNF rule

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Skip navigation links

Copyright © 1998, 2012, Oracle. All Rights Reserved.