org.apache.jdo.jdoql.tree
Interface QueryTree

All Superinterfaces:
ExpressionFactory, Node, java.io.Serializable
All Known Implementing Classes:
Tree

public interface QueryTree
extends ExpressionFactory, Node

Instances of classes implementing this interface represent the root of a query tree. You can use these intances to factorize this node's children, as there are candidate class, declarations, filter expression and ordering expressions as children.

Author:
Michael Watzek

Method Summary
 void addAscendingOrdering(Expression expression)
          Adds an ascending ordering expression to this query tree.
 void addDescendingOrdering(Expression expression)
          Adds an descending ordering expression to this query tree.
 void declareParameter(java.lang.Class type, java.lang.String parameter)
          Declares a parameter for this query tree.
 void declareVariable(java.lang.Class type, java.lang.String variable)
          Declares a variable for this query tree.
 java.lang.Class getCandidateClass()
          Returns the candidate class.
 java.util.Map getDeclaredParameters()
          Returns a map containing all declared parameters.
 java.util.List getDeclaredParametersAsList()
          Returns a list of all declared parameters.
 java.util.Map getDeclaredVariables()
          Returns a map containing all declared variables.
 Expression getFilter()
          Returns the filter expression of this query tree.
 java.util.List getOrderingExpressions()
          Returns a list of all added ordering expressions.
 void setCandidateClass(java.lang.Class clazz)
          Sets the candidate class for this query tree.
 void setFilter(Expression filter)
          Sets the filter expression for this query tree.
 
Methods inherited from interface org.apache.jdo.jdoql.tree.ExpressionFactory
newAnd, newCast, newComplement, newConditionalAnd, newConditionalOr, newConstant, newConstant, newConstant, newConstant, newConstant, newConstant, newConstant, newConstant, newConstant, newDivide, newEquals, newFieldAccess, newFieldAccess, newGreaterThan, newGreaterThanEquals, newIdentifier, newLessThan, newLessThanEquals, newMethodCall, newMinus, newMinus, newNot, newNotEquals, newOr, newPlus, newPlus, newTimes
 
Methods inherited from interface org.apache.jdo.jdoql.tree.Node
arrive, getChildren, getJavaClass, getObject, getParent, getTokenType, leave, setObject, setParent, walkNextChild
 

Method Detail

setCandidateClass

public void setCandidateClass(java.lang.Class clazz)
Sets the candidate class for this query tree.

Parameters:
clazz - the candidate class

declareParameter

public void declareParameter(java.lang.Class type,
                             java.lang.String parameter)
Declares a parameter for this query tree. Once you have declared a parameter, you can access it using method newIdentifier.

Parameters:
type - the instance of a Java class which is the type of the declared parameter
parameter - the name of the declared parameter

declareVariable

public void declareVariable(java.lang.Class type,
                            java.lang.String variable)
Declares a variable for this query tree. Once you have declared a variable, you can access it using method newIdentifier.

Parameters:
type - the instance of a Java class which is the type of the declared variable
variable - the name of the declared variable

setFilter

public void setFilter(Expression filter)
Sets the filter expression for this query tree.

Parameters:
filter - the filter expression

addAscendingOrdering

public void addAscendingOrdering(Expression expression)
Adds an ascending ordering expression to this query tree. The order of adding ascending and descending ordering expressions defines the order of instances in the result collection of an executed query instance corresponding with this query tree.

Parameters:
expression - the order expression

addDescendingOrdering

public void addDescendingOrdering(Expression expression)
Adds an descending ordering expression to this query tree. The order of adding ascending and descending ordering expressions defines the order of instances in the result collection of an executed query instance corresponding with this query tree.

Parameters:
expression - the order expression

getCandidateClass

public java.lang.Class getCandidateClass()
Returns the candidate class.

Returns:
the candidate class

getDeclaredParameters

public java.util.Map getDeclaredParameters()
Returns a map containing all declared parameters. This map contains parameter names as keys and instances of ParameterDeclaration as values.

Returns:
the map of declared parameters

getDeclaredVariables

public java.util.Map getDeclaredVariables()
Returns a map containing all declared variables. This map contains variable names as keys and instances of VariableDeclaration as values.

Returns:
the map of declared variables

getDeclaredParametersAsList

public java.util.List getDeclaredParametersAsList()
Returns a list of all declared parameters. The order of entries is defined by the order of calls declareParameter. This list contains instances of ParametersDeclaration as entries.

Returns:
the list of declared parameters

getFilter

public Expression getFilter()
Returns the filter expression of this query tree.

Returns:
the filter or null.

getOrderingExpressions

public java.util.List getOrderingExpressions()
Returns a list of all added ordering expressions. The order of entries is defined by the order of calls addAscendingOrdering and addDescendingOrdering. This list contains instances of OrderingExpression as entries.

Returns:
the list of declared parameters