Class NAryQueryNode<T extends QueryNode>
- java.lang.Object
-
- org.apache.jackrabbit.spi.commons.query.QueryNode
-
- org.apache.jackrabbit.spi.commons.query.NAryQueryNode<T>
-
- Direct Known Subclasses:
AndQueryNode,LocationStepQueryNode,NotQueryNode,OrQueryNode,PathQueryNode,RelationQueryNode
public abstract class NAryQueryNode<T extends QueryNode> extends QueryNode
Defines an abstract query node for nodes that have child nodes.
-
-
Field Summary
Fields Modifier and Type Field Description protected List<T>operandsThe list of operands / children-
Fields inherited from class org.apache.jackrabbit.spi.commons.query.QueryNode
TYPE_AND, TYPE_DEREF, TYPE_EXACT, TYPE_LOCATION, TYPE_NODETYPE, TYPE_NOT, TYPE_OR, TYPE_ORDER, TYPE_PATH, TYPE_PROP_FUNCTION, TYPE_RELATION, TYPE_ROOT, TYPE_TEXTSEARCH
-
-
Constructor Summary
Constructors Constructor Description NAryQueryNode(QueryNode parent)Creates a newNAryQueryNodewith a reference to a parentQueryNode.NAryQueryNode(QueryNode parent, T[] operands)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object[]acceptOperands(QueryNodeVisitor visitor, Object data)Helper class to accept avisitorfor all operands of thisNAryQueryNode.voidaddOperand(T operand)Adds a newoperand(child node) to this query node.booleanequals(Object obj)Returnstrueifobjis the same type ofQueryNodeasthisnode and is equal tothisnode.intgetNumOperands()Returns the number of operands.QueryNode[]getOperands()Returns an array of currently setQueryNodeoperands of thisQueryNode.booleanneedsSystemTree()Returnstrueif this query node needs items under /jcr:system to be queried.booleanremoveOperand(T operand)Removes anoperand(child node) from this query node.
-
-
-
Method Detail
-
addOperand
public void addOperand(T operand)
Adds a newoperand(child node) to this query node.- Parameters:
operand- the childQueryNodeto add.
-
removeOperand
public boolean removeOperand(T operand)
Removes anoperand(child node) from this query node.- Parameters:
operand- the child to remove.- Returns:
trueif the operand was in the list of child nodes and has been removed;falseif this node does not containoperandas a child node.
-
getOperands
public QueryNode[] getOperands()
Returns an array of currently setQueryNodeoperands of thisQueryNode. Returns an empty array if no operands are set.- Returns:
- currently set
QueryNodeoperands.
-
getNumOperands
public int getNumOperands()
Returns the number of operands.- Returns:
- the number of operands.
-
acceptOperands
public Object[] acceptOperands(QueryNodeVisitor visitor, Object data) throws RepositoryException
Helper class to accept avisitorfor all operands of thisNAryQueryNode.- Parameters:
visitor- the visitor to call back.data- arbitrary data for the visitor.- Returns:
- the return values of the
visitor.visit()calls. - Throws:
RepositoryException- if an error occurs.
-
equals
public boolean equals(Object obj)
Returnstrueifobjis the same type ofQueryNodeasthisnode and is equal tothisnode.
-
needsSystemTree
public boolean needsSystemTree()
Returnstrueif this query node needs items under /jcr:system to be queried.- Specified by:
needsSystemTreein classQueryNode- Returns:
trueif this query node needs content under /jcr:system to be queried;falseotherwise.
-
-