|
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.Object org.eclipse.persistence.jpa.jpql.parser.ExpressionRegistry
public class ExpressionRegistry
This registry contains the necessary information used by Hermes parser. When parsing a JPQL query,
the 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
Constructor Summary | |
---|---|
ExpressionRegistry()
Creates the only instance of ExpressionRegistry . |
Method Summary | |
---|---|
void |
addChildBNF(java.lang.String queryBNFId,
java.lang.String childQueryBNFId)
Adds to the given query BNF a child BNF. |
void |
addChildFactory(java.lang.String queryBNFId,
java.lang.String childExpressionFactoryId)
Adds to the given unique identifier of an ExpressionFactory to the given query BNF. |
void |
addIdentifier(java.lang.String expressionFactoryId,
java.lang.String identifier)
Adds the given JPQL identifier to this factory. |
void |
addIdentifiers(java.lang.String expressionFactoryId,
java.lang.String... identifiers)
Adds the given JPQL identifiers to this factory. |
ExpressionFactory |
expressionFactoryForIdentifier(java.lang.String identifier)
Retrieves the ExpressionFactory that is responsible for creating the Expression
object that represents the given JPQL identifier. |
ExpressionFactory |
getExpressionFactory(java.lang.String expressionFactoryId)
Retrieves the registered ExpressionFactory that was registered for the given unique identifier. |
IdentifierRole |
getIdentifierRole(java.lang.String identifier)
Retrieves the IdentifierRole of the given JPQL identifier. |
java.util.Set<java.lang.String> |
getIdentifiers()
Returns the JPQL identifiers that are supported by the JPQL grammar . |
java.lang.Iterable<java.lang.String> |
getIdentifiers(java.lang.String queryBNFId)
Retrieves the JPQL identifiers that are supported by the BNF rule with the given unique identifier. |
JPAVersion |
getIdentifierVersion(java.lang.String identifier)
Retrieves the JPA version in which the identifier was first introduced. |
JPQLQueryBNF |
getQueryBNF(java.lang.String queryBNFId)
Retrieves the BNF object that was registered for the given unique identifier. |
protected void |
initialize()
Instantiates the only instance of various API used by the parser. |
boolean |
isIdentifier(java.lang.String text)
Determines if the given word is a JPQL identifier. |
void |
registerBNF(JPQLQueryBNF queryBNF)
Registers the given JPQLQueryBNF . |
void |
registerFactory(ExpressionFactory expressionFactory)
Registers the given ExpressionFactory by storing it for all its identifiers. |
void |
registerIdentifierRole(java.lang.String identifier,
IdentifierRole role)
Registers the IdentifierRole for the given JPQL identifier. |
void |
registerIdentifierVersion(java.lang.String identifier,
JPAVersion version)
Registers the JPAVersion for which the given JPQL identifier was defined. |
void |
setFallbackBNFId(java.lang.String queryBNFId,
java.lang.String fallbackBNFId)
When parsing the query and no JPQLQueryBNFs can help to parse the query,
then it will fall back on the given one. |
void |
setFallbackExpressionFactoryId(java.lang.String queryBNFId,
java.lang.String fallbackExpressionFactoryId)
Sets the unique identifier of the ExpressionFactory to use when the fall back BNF
ID is not null . |
void |
setHandleSubExpression(java.lang.String queryBNFId,
boolean handleSubExpression)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExpressionRegistry()
ExpressionRegistry
.
Method Detail |
---|
public void addChildBNF(java.lang.String queryBNFId, java.lang.String childQueryBNFId)
queryBNFId
- The unique identifier of the parent BNF to add a child BNFchildQueryBNFId
- The unique identifier of the child to add to the parent BNF
java.lang.NullPointerException
- The JPQLQueryBNF
identified by the given ID does not existpublic void addChildFactory(java.lang.String queryBNFId, java.lang.String childExpressionFactoryId)
ExpressionFactory
to the given query BNF.
queryBNFId
- The unique identifier of the parent BNFchildExpressionFactoryId
- The unique identifier of the ExpressionFactory
to add
to the given query BNF
java.lang.NullPointerException
- The JPQLQueryBNF
identified by the given ID does not existpublic void addIdentifier(java.lang.String expressionFactoryId, java.lang.String identifier)
expressionFactoryId
- The unique identifier of the ExpressionFactory
to add more
JPQL identifiersidentifier
- The JPQL identifier this factory will parsepublic void addIdentifiers(java.lang.String expressionFactoryId, java.lang.String... identifiers)
expressionFactoryId
- The unique identifier of the ExpressionFactory
to add more
JPQL identifiersidentifiers
- The JPQL identifiers this factory will parsepublic ExpressionFactory expressionFactoryForIdentifier(java.lang.String identifier)
ExpressionFactory
that is responsible for creating the Expression
object that represents the given JPQL identifier.
identifier
- The JPQL identifier for which its factory is searched
ExpressionFactory
that creates the Expression
or
null
if none was foundpublic ExpressionFactory getExpressionFactory(java.lang.String expressionFactoryId)
ExpressionFactory
that was registered for the given unique identifier.
expressionFactoryId
- The unique identifier of the ExpressionFactory
to retrieve
ExpressionFactory
mapped with the given unique identifierpublic IdentifierRole getIdentifierRole(java.lang.String identifier)
IdentifierRole
of the given JPQL identifier. A role helps to describe
the purpose of the identifier in a JPQL query.
identifier
- The JPQL identifier for which its role is returned
IdentifierRole
of the given JPQL identifierpublic java.util.Set<java.lang.String> getIdentifiers()
JPQL grammar
.
public java.lang.Iterable<java.lang.String> getIdentifiers(java.lang.String queryBNFId)
ExpressionFactory
registered with the BNF rule and its child BNF rules.
public JPAVersion getIdentifierVersion(java.lang.String identifier)
public JPQLQueryBNF getQueryBNF(java.lang.String queryBNFId)
queryBNFId
- The unique identifier of the JPQLQueryBNF
to retrieve
JPQLQueryBNF
representing a section of the grammarprotected void initialize()
public boolean isIdentifier(java.lang.String text)
text
- The string value to test if it's a JPQL identifier based on what is registered
with this ExpressionRegistry
true
if the word is an identifier, false
otherwisepublic void registerBNF(JPQLQueryBNF queryBNF)
JPQLQueryBNF
. The BNF will be registered using its unique
identifier.
queryBNF
- The JPQLQueryBNF
to store
java.lang.NullPointerException
- The JPQLQueryBNF
cannot be null
public void registerFactory(ExpressionFactory expressionFactory)
ExpressionFactory
by storing it for all its identifiers.
expressionFactory
- The ExpressionFactory
to store
java.lang.NullPointerException
- The ExpressionFactory
cannot be null
public void registerIdentifierRole(java.lang.String identifier, IdentifierRole role)
IdentifierRole
for the given JPQL identifier.
identifier
- The JPQL identifier to register its role within a JPQL queryrole
- The role of the given JPQL identifier
java.lang.NullPointerException
- The JPQL identifier and the cannot be
null
public void registerIdentifierVersion(java.lang.String identifier, JPAVersion version)
JPAVersion
for which the given JPQL identifier was defined.
identifier
- The JPQL identifier to register in which version it was added to the grammarversion
- The version when the JPQL identifier was added to the grammar
java.lang.NullPointerException
- The JPQL identifier and the JPAVersion
cannot be
null
public void setFallbackBNFId(java.lang.String queryBNFId, java.lang.String fallbackBNFId)
JPQLQueryBNFs
can help to parse the query,
then it will fall back on the given one.
queryBNFId
- The unique identifier of the BNF to modify its fallback BNF unique identifierfallbackBNFId
- The unique identifier of the JPQLQueryBNF
to use in the last resort
java.lang.NullPointerException
- The JPQLQueryBNF
identified by the given ID does not existpublic void setFallbackExpressionFactoryId(java.lang.String queryBNFId, 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 JPQLQueryBNF.
getFallbackBNFId()
does not return null
.
queryBNFId
- The unique identifier of the BNF to modify its fallback expression factory
unique identifier
java.lang.NullPointerException
- The JPQLQueryBNF
identified by the given ID does not existpublic void setHandleSubExpression(java.lang.String queryBNFId, boolean handleSubExpression)
|
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 |