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 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 newNAryQueryNode
with a reference to a parentQueryNode
.NAryQueryNode(QueryNode parent, T[] operands)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object[]
acceptOperands(QueryNodeVisitor visitor, java.lang.Object data)
Helper class to accept avisitor
for all operands of thisNAryQueryNode
.void
addOperand(T operand)
Adds a newoperand
(child node) to this query node.boolean
equals(java.lang.Object obj)
Returnstrue
ifobj
is the same type ofQueryNode
asthis
node and is equal tothis
node.int
getNumOperands()
Returns the number of operands.QueryNode[]
getOperands()
Returns an array of currently setQueryNode
operands of thisQueryNode
.boolean
needsSystemTree()
Returnstrue
if this query node needs items under /jcr:system to be queried.boolean
removeOperand(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 childQueryNode
to add.
-
removeOperand
public boolean removeOperand(T operand)
Removes anoperand
(child node) from this query node.- Parameters:
operand
- the child to remove.- Returns:
true
if the operand was in the list of child nodes and has been removed;false
if this node does not containoperand
as a child node.
-
getOperands
public QueryNode[] getOperands()
Returns an array of currently setQueryNode
operands of thisQueryNode
. Returns an empty array if no operands are set.- Returns:
- currently set
QueryNode
operands.
-
getNumOperands
public int getNumOperands()
Returns the number of operands.- Returns:
- the number of operands.
-
acceptOperands
public java.lang.Object[] acceptOperands(QueryNodeVisitor visitor, java.lang.Object data) throws RepositoryException
Helper class to accept avisitor
for 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(java.lang.Object obj)
Returnstrue
ifobj
is the same type ofQueryNode
asthis
node and is equal tothis
node.
-
needsSystemTree
public boolean needsSystemTree()
Returnstrue
if this query node needs items under /jcr:system to be queried.- Specified by:
needsSystemTree
in classQueryNode
- Returns:
true
if this query node needs content under /jcr:system to be queried;false
otherwise.
-
-