org.datanucleus.query.compiler
Class JDOQLParser

java.lang.Object
  extended by org.datanucleus.query.compiler.JDOQLParser
All Implemented Interfaces:
Parser

public class JDOQLParser
extends java.lang.Object
implements Parser

Implementation of a parser for JDOQL query language. Generates Node tree(s) by use of the various parseXXX() methods.


Field Summary
protected static Localiser LOCALISER
          Localiser for messages.
 
Constructor Summary
JDOQLParser(java.util.Map options)
          Constructor for a JDOQL Parser.
 
Method Summary
 Node parse(java.lang.String expression)
           
 Node[] parseFrom(java.lang.String expression)
           
 Node[] parseOrder(java.lang.String expression)
           
 Node[][] parseParameters(java.lang.String expression)
           
 Node[] parseResult(java.lang.String expression)
          The RESULT expression in JDOQL can include aggregates, fields, as well as aliases myfield [AS] alias, myfield2" The Node tree for this would be
 Node[] parseTupple(java.lang.String expression)
           
 Node[] parseUpdate(java.lang.String expression)
           
 Node parseVariable(java.lang.String expression)
           
 Node[][] parseVariables(java.lang.String expression)
           
protected  void processAdditiveExpression()
           
protected  boolean processLiteral()
          A literal is one value of any type.
protected  void processMultiplicativeExpression()
           
protected  void processPrimary()
          Parses the primary.
protected  void processUnaryExpression()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Localiser for messages.

Constructor Detail

JDOQLParser

public JDOQLParser(java.util.Map options)
Constructor for a JDOQL Parser. Supports "jdoql.level" option so can have strict JDO2 syntax, or flexible.

Parameters:
options - parser options
Method Detail

parse

public Node parse(java.lang.String expression)
Specified by:
parse in interface Parser

parseVariable

public Node parseVariable(java.lang.String expression)
Specified by:
parseVariable in interface Parser

parseFrom

public Node[] parseFrom(java.lang.String expression)
Specified by:
parseFrom in interface Parser

parseUpdate

public Node[] parseUpdate(java.lang.String expression)
Specified by:
parseUpdate in interface Parser

parseOrder

public Node[] parseOrder(java.lang.String expression)
Specified by:
parseOrder in interface Parser

parseResult

public Node[] parseResult(java.lang.String expression)
The RESULT expression in JDOQL can include aggregates, fields, as well as aliases The Node tree for this would be
[
 [IDENTIFIER : myfield.
      [NAME : alias]],
 [IDENTIFIER : myfield2]
 ]

Specified by:
parseResult in interface Parser
Returns:
Node tree(s) for the RESULT expression

parseTupple

public Node[] parseTupple(java.lang.String expression)
Specified by:
parseTupple in interface Parser

parseVariables

public Node[][] parseVariables(java.lang.String expression)
Specified by:
parseVariables in interface Parser

parseParameters

public Node[][] parseParameters(java.lang.String expression)
Specified by:
parseParameters in interface Parser

processAdditiveExpression

protected void processAdditiveExpression()

processMultiplicativeExpression

protected void processMultiplicativeExpression()

processUnaryExpression

protected void processUnaryExpression()

processPrimary

protected void processPrimary()
Parses the primary. First look for a literal (e.g. "text"), then an identifier(e.g. variable) In the next step, call a function, if executing a function, on the literal or the identifier found.


processLiteral

protected boolean processLiteral()
A literal is one value of any type. Supported literals are of types String, Floating Point, Integer, Character, Boolean and null e.g. 'J', "String", 1, 1.8, true, false, null.

Returns:
The parsed literal


Copyright © 2010. All Rights Reserved.