Class JDOQLParser
- java.lang.Object
-
- org.datanucleus.store.query.compiler.AbstractParser
-
- org.datanucleus.store.query.compiler.JDOQLParser
-
- All Implemented Interfaces:
Parser
public class JDOQLParser extends AbstractParser
Implementation of a parser for JDOQL query language. Generates Node tree(s) by use of the various parseXXX() methods.
-
-
Field Summary
-
Fields inherited from class org.datanucleus.store.query.compiler.AbstractParser
lexer, stack, strict
-
-
Constructor Summary
Constructors Constructor Description JDOQLParser()Constructor for a JDOQL Parser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidallowSingleEquals(boolean flag)Method to set whether "=" is allowed.Nodeparse(String expression)Node[]parseFrom(String expression)Node[]parseOrder(String expression)Node[][]parseParameters(String expression)Node[]parseResult(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 beNode[]parseTuple(String expression)Node[]parseUpdate(String expression)NodeparseVariable(String expression)Node[][]parseVariables(String expression)protected voidprocessAdditiveExpression()protected booleanprocessLiteral()A literal is one value of any type.protected voidprocessMultiplicativeExpression()protected voidprocessPrimary()Parses the primary.protected voidprocessUnaryExpression()voidsetExplicitParameters(boolean flag)-
Methods inherited from class org.datanucleus.store.query.compiler.AbstractParser
getLastDescendantNodeForNode, setStrict
-
-
-
-
Method Detail
-
setExplicitParameters
public void setExplicitParameters(boolean flag)
- Specified by:
setExplicitParametersin interfaceParser- Overrides:
setExplicitParametersin classAbstractParser
-
allowSingleEquals
public void allowSingleEquals(boolean flag)
Method to set whether "=" is allowed. It is valid in an UPDATE clause, but not in a WHERE clause, for example.- Parameters:
flag- Whether to allow it
-
parseResult
public Node[] parseResult(String expression)
The RESULT expression in JDOQL can include aggregates, fields, as well as aliases- myfield [AS] alias, myfield2"
[ [IDENTIFIER : myfield. [NAME : alias]], [IDENTIFIER : myfield2] ]- Returns:
- Node tree(s) for the RESULT expression
-
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
-
-