org.datanucleus.query.compiler
Class JPQLCompiler

java.lang.Object
  extended by org.datanucleus.query.compiler.JavaQueryCompiler
      extended by org.datanucleus.query.compiler.JPQLCompiler
All Implemented Interfaces:
SymbolResolver

public class JPQLCompiler
extends JavaQueryCompiler

Implementation of a compiler for JPQL (JSR0220, JSR0317).


Field Summary
 
Fields inherited from class org.datanucleus.query.compiler.JavaQueryCompiler
candidateAlias, candidateAliasOrig, candidateClass, candidates, caseSensitiveAliases, clr, filter, from, grouping, having, imports, LOCALISER, metaDataManager, ordering, parameters, parameterSubstitutionNumber, parameterSubtitutionMap, parentCompiler, parser, queryMethodAliasByPrefix, result, symtbl, update, variables
 
Constructor Summary
JPQLCompiler(MetaDataManager metaDataManager, ClassLoaderResolver clr, java.lang.String from, java.lang.Class candidateClass, java.util.Collection candidates, java.lang.String filter, Imports imports, java.lang.String ordering, java.lang.String result, java.lang.String grouping, java.lang.String having, java.lang.String params, java.lang.String update)
           
 
Method Summary
 boolean caseSensitiveSymbolNames()
          Whether names of symbols are case-sensitive (e.g JDOQL returns true, but JPQL returns false).
 QueryCompilation compile(java.util.Map parameters, java.util.Map subqueryMap)
          Method to compile the query, and return the compiled results.
 java.lang.String getLanguage()
          Accessor for the query language name.
protected  boolean isKeyword(java.lang.String name)
          Method to return if the supplied name is a keyword.
 boolean supportsImplicitVariables()
          Whether we should accept implicit variables in the query.
 
Methods inherited from class org.datanucleus.query.compiler.JavaQueryCompiler
compileCandidatesParametersVariables, compileFilter, compileFrom, compileGrouping, compileHaving, compileOrdering, compileResult, compileUpdate, getPrimaryClass, getType, resolveClass, setLinkToParentQuery, swapCandidateAliasNodeName, swapSubqueryParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JPQLCompiler

public JPQLCompiler(MetaDataManager metaDataManager,
                    ClassLoaderResolver clr,
                    java.lang.String from,
                    java.lang.Class candidateClass,
                    java.util.Collection candidates,
                    java.lang.String filter,
                    Imports imports,
                    java.lang.String ordering,
                    java.lang.String result,
                    java.lang.String grouping,
                    java.lang.String having,
                    java.lang.String params,
                    java.lang.String update)
Method Detail

compile

public QueryCompilation compile(java.util.Map parameters,
                                java.util.Map subqueryMap)
Method to compile the query, and return the compiled results.

Specified by:
compile in class JavaQueryCompiler
Parameters:
parameters - the parameter map of values keyed by param name
subqueryMap - Map of subquery variables, keyed by the subquery name
Returns:
The compiled query

supportsImplicitVariables

public boolean supportsImplicitVariables()
Description copied from interface: SymbolResolver
Whether we should accept implicit variables in the query. JDOQL supports variables, yet JPQL doesn't. Also in JDOQL if the user supplies some explicit variables then it doesn't allow implicit variables.

Returns:
Whether to support implicit variables

caseSensitiveSymbolNames

public boolean caseSensitiveSymbolNames()
Description copied from interface: SymbolResolver
Whether names of symbols are case-sensitive (e.g JDOQL returns true, but JPQL returns false).

Returns:
Whether case sensitive

getLanguage

public java.lang.String getLanguage()
Accessor for the query language name.

Specified by:
getLanguage in class JavaQueryCompiler
Returns:
Name of the query language.

isKeyword

protected boolean isKeyword(java.lang.String name)
Method to return if the supplied name is a keyword. Keywords can only appear at particular places in a query so we need to detect for valid queries.

Specified by:
isKeyword in class JavaQueryCompiler
Parameters:
name - The name
Returns:
Whether it is a keyword


Copyright © 2011. All Rights Reserved.