|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jdo.jdoql.tree.AbstractNodeVisitor
org.apache.jdo.impl.jdoql.tree.FilterExpressionDumper
public class FilterExpressionDumper
An instance of this class is used to print a query tree
into a print stream. The tree is printed as a string representation.
The filter of this representation can be used as argument for method
Query.setFilter
.
As this class inherits from AbstractNodeVisitor
, it only
overwrites those methods that need to dump and relies on the delegation
mechanism for the remaining methods implemented in
AbstractNodeVisitor
.
Constructor Summary | |
---|---|
FilterExpressionDumper()
Constructs an instance of this class. |
|
FilterExpressionDumper(java.io.PrintStream out)
Constructs an instance of this class. |
Method Summary | |
---|---|
void |
arrive(AscendingOrderingExpression node)
Ascending ordering expressions are dumped like Ascending(expression) . |
protected void |
arrive(BinaryExpression node)
Binary expressions are dumped in parenthesized manner. |
void |
arrive(CastExpression node)
Cast expressions are dumped like (type)expression . |
void |
arrive(ComplementExpression node)
Complement expressions are dumped like ~expression . |
void |
arrive(ConstantExpression node)
Dumps the value of the argument node . |
void |
arrive(DescendingOrderingExpression node)
Descending ordering expressions are dumped like Descending(expression) . |
void |
arrive(FieldAccessExpression node)
Field access expressions are dumped like target.fieldName . |
void |
arrive(IdentifierExpression node)
Dumps the name of an identifier expression. |
void |
arrive(NotExpression node)
Dumps a not expression. |
void |
arrive(UnaryMinusExpression node)
Unary minus expressions are dumped like -expression . |
protected java.lang.Object |
leave(BinaryExpression node,
java.lang.Object[] results)
Binary expressions are dumped in parenthesized manner. |
java.lang.Object |
leave(FieldAccessExpression node,
java.lang.Object[] results)
Field access expressions are dumped like target.fieldName . |
protected java.lang.Object |
leave(MethodCallExpression node,
java.lang.Object[] results)
Method call expressions are dumped like target.methodName(arguments) . |
protected java.lang.Object |
leave(OrderingExpression node,
java.lang.Object[] results)
Ordering expressions are dumped like Ascending/Descending(expression) . |
java.lang.Object |
leave(QueryTree node,
java.lang.Object[] results)
Query trees are dumped like orderingExpressions, filterExpression . |
boolean |
walkNextChild(AndExpression node,
java.lang.Object resultOfPreviousChild,
int indexOfNextChild)
A logical and expression is dumped like (leftExpression & rightExpression) . |
boolean |
walkNextChild(ConditionalAndExpression node,
java.lang.Object resultOfPreviousChild,
int indexOfNextChild)
A conditional and expression is dumped like (leftExpression && rightExpression) . |
boolean |
walkNextChild(ConditionalOrExpression node,
java.lang.Object resultOfPreviousChild,
int indexOfNextChild)
A logical or expression is dumped like (leftExpression || rightExpression) . |
boolean |
walkNextChild(DivideExpression node,
java.lang.Object resultOfPreviousChild,
int indexOfNextChild)
A divide expression is dumped like (leftExpression / rightExpression) . |
boolean |
walkNextChild(EqualsExpression node,
java.lang.Object resultOfPreviousChild,
int indexOfNextChild)
An equals expression is dumped like (leftExpression == rightExpression) . |
boolean |
walkNextChild(GreaterThanEqualsExpression node,
java.lang.Object resultOfPreviousChild,
int indexOfNextChild)
A greater than equals expression is dumped like (leftExpression >= rightExpression) . |
boolean |
walkNextChild(GreaterThanExpression node,
java.lang.Object resultOfPreviousChild,
int indexOfNextChild)
A greater than expression is dumped like (leftExpression > rightExpression) . |
boolean |
walkNextChild(LessThanEqualsExpression node,
java.lang.Object resultOfPreviousChild,
int indexOfNextChild)
A less than equals expression is dumped like (leftExpression <= rightExpression) . |
boolean |
walkNextChild(LessThanExpression node,
java.lang.Object resultOfPreviousChild,
int indexOfNextChild)
A less than expression is dumped like (leftExpression < rightExpression) . |
protected boolean |
walkNextChild(MethodCallExpression node,
java.lang.Object resultOfPreviousChild,
int indexOfNextChild)
Method call expressions are dumped like target.methodName(arguments) . |
boolean |
walkNextChild(MinusExpression node,
java.lang.Object resultOfPreviousChild,
int indexOfNextChild)
A minus expression is dumped like (leftExpression - rightExpression) . |
boolean |
walkNextChild(NotEqualsExpression node,
java.lang.Object resultOfPreviousChild,
int indexOfNextChild)
Dumps a not equals expression. |
boolean |
walkNextChild(OrExpression node,
java.lang.Object resultOfPreviousChild,
int indexOfNextChild)
A logical or expression is dumped like (leftExpression | rightExpression) . |
boolean |
walkNextChild(PlusExpression node,
java.lang.Object resultOfPreviousChild,
int indexOfNextChild)
A plus expression is dumped like (leftExpression + rightExpression) . |
boolean |
walkNextChild(QueryTree node,
java.lang.Object resultOfPreviousChild,
int indexOfNextChild)
Query trees are dumped like orderingExpressions,
filterExpression . |
boolean |
walkNextChild(TimesExpression node,
java.lang.Object resultOfPreviousChild,
int indexOfNextChild)
A times expression is dumped like (leftExpression * rightExpression) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FilterExpressionDumper()
System.out
.
public FilterExpressionDumper(java.io.PrintStream out)
out
.
out
- the print stream to dump toMethod Detail |
---|
protected void arrive(BinaryExpression node)
arrive
in class AbstractNodeVisitor
node
- the node to dumpprotected java.lang.Object leave(BinaryExpression node, java.lang.Object[] results)
leave
in class AbstractNodeVisitor
node
- the node to dumpresults
- an array of null
instances
null
protected java.lang.Object leave(MethodCallExpression node, java.lang.Object[] results)
target.methodName(arguments)
.
leave
in class AbstractNodeVisitor
node
- the node to dumpresults
- an array of null
instances
null
protected java.lang.Object leave(OrderingExpression node, java.lang.Object[] results)
Ascending/Descending(expression)
.
leave
in class AbstractNodeVisitor
node
- the node to dumpresults
- an array of null
instances
null
protected boolean walkNextChild(MethodCallExpression node, java.lang.Object resultOfPreviousChild, int indexOfNextChild)
target.methodName(arguments)
.
walkNextChild
in class AbstractNodeVisitor
node
- the parent node of the children currently dumpedresultOfPreviousChild
- the result of the previsous child nodeindexOfNextChild
- the index of the next child to be dumped
true
public void arrive(AscendingOrderingExpression node)
Ascending(expression)
.
arrive
in interface NodeVisitor
arrive
in class AbstractNodeVisitor
node
- the node to dumppublic void arrive(DescendingOrderingExpression node)
Descending(expression)
.
arrive
in interface NodeVisitor
arrive
in class AbstractNodeVisitor
node
- the node to dumppublic void arrive(ConstantExpression node)
node
. If that node holds
a String instance, then the string value is dumped in double quotes.
arrive
in interface NodeVisitor
arrive
in class AbstractNodeVisitor
node
- the node to dumppublic void arrive(CastExpression node)
(type)expression
.
arrive
in interface NodeVisitor
arrive
in class AbstractNodeVisitor
node
- the node to dumppublic void arrive(FieldAccessExpression node)
target.fieldName
.
arrive
in interface NodeVisitor
arrive
in class AbstractNodeVisitor
node
- the node to dumppublic void arrive(ComplementExpression node)
~expression
.
arrive
in interface NodeVisitor
arrive
in class AbstractNodeVisitor
node
- the node to dumppublic void arrive(IdentifierExpression node)
arrive
in interface NodeVisitor
arrive
in class AbstractNodeVisitor
node
- the node to dumppublic void arrive(NotExpression node)
!expression
.
arrive
in interface NodeVisitor
arrive
in class AbstractNodeVisitor
node
- the node to dumppublic void arrive(UnaryMinusExpression node)
-expression
.
arrive
in interface NodeVisitor
arrive
in class AbstractNodeVisitor
node
- the node to dumppublic java.lang.Object leave(FieldAccessExpression node, java.lang.Object[] results)
target.fieldName
.
leave
in interface NodeVisitor
leave
in class AbstractNodeVisitor
node
- the node to dumpresults
- the results of walking the node's children
public java.lang.Object leave(QueryTree node, java.lang.Object[] results)
orderingExpressions, filterExpression
.
leave
in interface NodeVisitor
leave
in class AbstractNodeVisitor
node
- the node to dumpresults
- the results of walking the node's children
public boolean walkNextChild(AndExpression node, java.lang.Object resultOfPreviousChild, int indexOfNextChild)
(leftExpression & rightExpression)
.
walkNextChild
in interface NodeVisitor
walkNextChild
in class AbstractNodeVisitor
node
- the parent node of the children currently dumpedresultOfPreviousChild
- an array of null
instancesindexOfNextChild
- the index of the next child to be dumped
true
public boolean walkNextChild(ConditionalAndExpression node, java.lang.Object resultOfPreviousChild, int indexOfNextChild)
(leftExpression && rightExpression)
.
walkNextChild
in interface NodeVisitor
walkNextChild
in class AbstractNodeVisitor
node
- the parent node of the children currently dumpedresultOfPreviousChild
- an array of null
instancesindexOfNextChild
- the index of the next child to be dumped
true
public boolean walkNextChild(ConditionalOrExpression node, java.lang.Object resultOfPreviousChild, int indexOfNextChild)
(leftExpression || rightExpression)
.
walkNextChild
in interface NodeVisitor
walkNextChild
in class AbstractNodeVisitor
node
- the parent node of the children currently dumpedresultOfPreviousChild
- an array of null
instancesindexOfNextChild
- the index of the next child to be dumped
true
public boolean walkNextChild(DivideExpression node, java.lang.Object resultOfPreviousChild, int indexOfNextChild)
(leftExpression / rightExpression)
.
walkNextChild
in interface NodeVisitor
walkNextChild
in class AbstractNodeVisitor
node
- the parent node of the children currently dumpedresultOfPreviousChild
- an array of null
instancesindexOfNextChild
- the index of the next child to be dumped
true
public boolean walkNextChild(EqualsExpression node, java.lang.Object resultOfPreviousChild, int indexOfNextChild)
(leftExpression == rightExpression)
.
walkNextChild
in interface NodeVisitor
walkNextChild
in class AbstractNodeVisitor
node
- the parent node of the children currently dumpedresultOfPreviousChild
- an array of null
instancesindexOfNextChild
- the index of the next child to be dumped
true
public boolean walkNextChild(GreaterThanEqualsExpression node, java.lang.Object resultOfPreviousChild, int indexOfNextChild)
(leftExpression >= rightExpression)
.
walkNextChild
in interface NodeVisitor
walkNextChild
in class AbstractNodeVisitor
node
- the parent node of the children currently dumpedresultOfPreviousChild
- an array of null
instancesindexOfNextChild
- the index of the next child to be dumped
true
public boolean walkNextChild(GreaterThanExpression node, java.lang.Object resultOfPreviousChild, int indexOfNextChild)
(leftExpression > rightExpression)
.
walkNextChild
in interface NodeVisitor
walkNextChild
in class AbstractNodeVisitor
node
- the parent node of the children currently dumpedresultOfPreviousChild
- an array of null
instancesindexOfNextChild
- the index of the next child to be dumped
true
public boolean walkNextChild(LessThanEqualsExpression node, java.lang.Object resultOfPreviousChild, int indexOfNextChild)
(leftExpression <= rightExpression)
.
walkNextChild
in interface NodeVisitor
walkNextChild
in class AbstractNodeVisitor
node
- the parent node of the children currently dumpedresultOfPreviousChild
- an array of null
instancesindexOfNextChild
- the index of the next child to be dumped
true
public boolean walkNextChild(LessThanExpression node, java.lang.Object resultOfPreviousChild, int indexOfNextChild)
(leftExpression < rightExpression)
.
walkNextChild
in interface NodeVisitor
walkNextChild
in class AbstractNodeVisitor
node
- the parent node of the children currently dumpedresultOfPreviousChild
- an array of null
instancesindexOfNextChild
- the index of the next child to be dumped
true
public boolean walkNextChild(MinusExpression node, java.lang.Object resultOfPreviousChild, int indexOfNextChild)
(leftExpression - rightExpression)
.
walkNextChild
in interface NodeVisitor
walkNextChild
in class AbstractNodeVisitor
node
- the parent node of the children currently dumpedresultOfPreviousChild
- an array of null
instancesindexOfNextChild
- the index of the next child to be dumped
true
public boolean walkNextChild(NotEqualsExpression node, java.lang.Object resultOfPreviousChild, int indexOfNextChild)
(leftExpression != rightExpression)
.
walkNextChild
in interface NodeVisitor
walkNextChild
in class AbstractNodeVisitor
node
- the parent node of the children currently dumpedresultOfPreviousChild
- an array of null
instancesindexOfNextChild
- the index of the next child to be dumped
true
public boolean walkNextChild(OrExpression node, java.lang.Object resultOfPreviousChild, int indexOfNextChild)
(leftExpression | rightExpression)
.
walkNextChild
in interface NodeVisitor
walkNextChild
in class AbstractNodeVisitor
node
- the parent node of the children currently dumpedresultOfPreviousChild
- an array of null
instancesindexOfNextChild
- the index of the next child to be dumped
true
public boolean walkNextChild(QueryTree node, java.lang.Object resultOfPreviousChild, int indexOfNextChild)
orderingExpressions,
filterExpression
.
walkNextChild
in interface NodeVisitor
walkNextChild
in class AbstractNodeVisitor
node
- the parent node of the children currently dumpedresultOfPreviousChild
- an array of null
instancesindexOfNextChild
- the index of the next child to be dumped
true
public boolean walkNextChild(PlusExpression node, java.lang.Object resultOfPreviousChild, int indexOfNextChild)
(leftExpression + rightExpression)
.
walkNextChild
in interface NodeVisitor
walkNextChild
in class AbstractNodeVisitor
node
- the parent node of the children currently dumpedresultOfPreviousChild
- an array of null
instancesindexOfNextChild
- the index of the next child to be dumped
true
public boolean walkNextChild(TimesExpression node, java.lang.Object resultOfPreviousChild, int indexOfNextChild)
(leftExpression * rightExpression)
.
walkNextChild
in interface NodeVisitor
walkNextChild
in class AbstractNodeVisitor
node
- the parent node of the children currently dumpedresultOfPreviousChild
- an array of null
instancesindexOfNextChild
- the index of the next child to be dumped
true
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |