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 ExpressionRegistry

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


final class ExpressionRegistry
extends java.lang.Object

This registry initializes the singleton instances of various API required for parsing a JPQL query. It supports version 1.0 and 2.0 of the JPQL language as well as the EclipseLink's extension over the language.

Since:
2.3
Version:
2.3
Author:
Pascal Filion

Field Summary
private  java.util.Map<java.lang.String,ExpressionFactory> expressionFactories
          The map of ExpressionFactories that have been registered and required for parsing a JPQL query, they are mapped with their unique identifier.
private  java.util.Map<java.lang.String,IdentifierRole> identifiers
          The set of the JPQL identifiers defined by the grammar.
private  java.util.Map<java.lang.String,IJPAVersion> identifiersVersions
          This table specify in which JPA version the identifiers was introduced.
private  java.util.Map<java.lang.String,JPQLQueryBNF> queryBNFs
          The JPQLQueryBNF unique identifiers mapped to the only instance of the BNF rule.

 

Constructor Summary
ExpressionRegistry()
          Creates the only instance of ExpressionRegistry.

 

Method Summary
(package private)  ExpressionFactory expressionFactory(java.lang.String expressionFactoryId)
          Retrieves the registered ExpressionFactory that was registered for the given unique identifier.
(package private)  ExpressionFactory expressionFactoryForIdentifier(java.lang.String identifier)
          Retrieves the ExpressionFactory that is responsible for creating the Expression object that represents the given JPQL identifier.
(package private)  IdentifierRole identifierRole(java.lang.String identifier)
          Retrieves the role of the given identifier.
(package private)  java.util.Collection<java.lang.String> identifiers()
          Returns the JPQL identifiers defined for JPQL version 1.0 and 2.0.
(package private)  java.lang.Iterable<java.lang.String> identifiers(java.lang.String queryBNFId)
          Retrieves the identifiers that are supported by the given BNF.
(package private)  IJPAVersion identifierVersion(java.lang.String identifier)
          Retrieves the JPA version in which the identifier was first introduced.
private  void initialize()
          Instantiates the only instance of various API used by the parser.
private  void initializeBNFs()
          Creates a map where the key is a unique ID and the value is an JPQLQueryBNF representing a portion of the JPQL grammar.
private  void initializeExpressionFactories()
          Creates a map where the key is an identifier and the value is an ExpressionFactory responsible to create the actual Expression.
private  void initializeIdentifiers()
          Creates the list of JPQL identifiers, which cannot be used as identification variables.
(package private)  boolean isIdentifier(java.lang.String word)
          Determines if the given word is a JPQL identifier.
(package private)
<T extends JPQLQueryBNF>
T
queryBNF(java.lang.String queryBNFID)
          Retrieves the BNF object that was registered for the given unique identifier.
private  void registerBNF(JPQLQueryBNF queryBNF)
          Registers the given ExpressionFactory by storing it for all its identifiers.
private  void registerFactory(ExpressionFactory expressionFactory)
          Registers the given ExpressionFactory by storing it for all its identifiers.

 

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

 

Field Detail

expressionFactories

private java.util.Map<java.lang.String,ExpressionFactory> expressionFactories
The map of ExpressionFactories that have been registered and required for parsing a JPQL query, they are mapped with their unique identifier.

identifiers

private java.util.Map<java.lang.String,IdentifierRole> identifiers
The set of the JPQL identifiers defined by the grammar.

identifiersVersions

private java.util.Map<java.lang.String,IJPAVersion> identifiersVersions
This table specify in which JPA version the identifiers was introduced.

queryBNFs

private java.util.Map<java.lang.String,JPQLQueryBNF> queryBNFs
The JPQLQueryBNF unique identifiers mapped to the only instance of the BNF rule.

Constructor Detail

ExpressionRegistry

ExpressionRegistry()
Creates the only instance of ExpressionRegistry.

Method Detail

expressionFactory

ExpressionFactory expressionFactory(java.lang.String expressionFactoryId)
Retrieves the registered ExpressionFactory that was registered for the given unique identifier.
Parameters:
expressionFactoryId - The unique identifier of the ExpressionFactory to retrieve
Returns:
The ExpressionFactory mapped with the given unique identifier

expressionFactoryForIdentifier

ExpressionFactory expressionFactoryForIdentifier(java.lang.String identifier)
Retrieves the ExpressionFactory that is responsible for creating the Expression object that represents the given JPQL identifier.
Parameters:
identifier - The JPQL identifier for which its factory is searched
Returns:
Either the ExpressionFactory that creates the Expression or null if none was found

identifierRole

IdentifierRole identifierRole(java.lang.String identifier)
Retrieves the role of the given identifier. A role helps to describe the purpose of the identifier in a query.
Parameters:
identifier - The identifier for which its role is requested
Returns:
The role of the given identifier

identifiers

java.util.Collection<java.lang.String> identifiers()
Returns the JPQL identifiers defined for JPQL version 1.0 and 2.0.
Returns:
The set of identifiers

identifiers

java.lang.Iterable<java.lang.String> identifiers(java.lang.String queryBNFId)
Retrieves the identifiers that are supported by the given BNF.
Parameters:
queryBNFId - The unique identifier of the BNF for which the supported identifiers are requested
Returns:
The list of JPQL identifiers that can be used with the BNF

identifierVersion

IJPAVersion identifierVersion(java.lang.String identifier)
Retrieves the JPA version in which the identifier was first introduced.
Returns:
The version in which the identifier was introduced

initialize

private void initialize()
Instantiates the only instance of various API used by the parser.

initializeBNFs

private void initializeBNFs()
Creates a map where the key is a unique ID and the value is an JPQLQueryBNF representing a portion of the JPQL grammar.

initializeExpressionFactories

private void initializeExpressionFactories()
Creates a map where the key is an identifier and the value is an ExpressionFactory responsible to create the actual Expression.

initializeIdentifiers

private void initializeIdentifiers()
Creates the list of JPQL identifiers, which cannot be used as identification variables.

isIdentifier

boolean isIdentifier(java.lang.String word)
Determines if the given word is a JPQL identifier. The check is case insensitive.
Parameters:
word - The word to test if it's a JPQL identifier
Returns:
true if the word is an identifier, false otherwise

queryBNF

<T extends JPQLQueryBNF> T queryBNF(java.lang.String queryBNFID)
Retrieves the BNF object that was registered for the given unique identifier.
Parameters:
queryBNFID - The unique identifier of the JPQLQueryBNF to retrieve
Returns:
The JPQLQueryBNF representing a section of the grammar

registerBNF

private void registerBNF(JPQLQueryBNF queryBNF)
Registers the given ExpressionFactory by storing it for all its identifiers.
Parameters:
expressionFactory - The ExpressionFactory to store

registerFactory

private void registerFactory(ExpressionFactory expressionFactory)
Registers the given ExpressionFactory by storing it for all its identifiers.
Parameters:
expressionFactory - The ExpressionFactory to store

Skip navigation links

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