org.apache.jackrabbit.commons.predicate
Class NodeTypePredicate

java.lang.Object
  extended by org.apache.jackrabbit.commons.predicate.DepthPredicate
      extended by org.apache.jackrabbit.commons.predicate.NodeTypePredicate
All Implemented Interfaces:
Predicate

public class NodeTypePredicate
extends DepthPredicate

Filters on the node type of a node.


Field Summary
protected  String nodeType
          the nodetype to filter on
protected  boolean respectSupertype
          indicates if supertypes should be respected
 
Fields inherited from class org.apache.jackrabbit.commons.predicate.DepthPredicate
maxDepth, minDepth
 
Fields inherited from interface org.apache.jackrabbit.commons.predicate.Predicate
FALSE, TRUE
 
Constructor Summary
NodeTypePredicate(String nodeType, boolean respectSupertype)
          Creates a new node type filter.
NodeTypePredicate(String nodeType, boolean respectSupertype, int minDepth, int maxDepth)
          Creates a new node type filter.
 
Method Summary
protected  boolean matches(Item item)
          Returns true if the item is a node and if the configured nodetype is equal to the primary type of the node. if supertypes are respected it also returns true if the items nodetype extends from the configured node type (Node.isNodeType() check).
 
Methods inherited from class org.apache.jackrabbit.commons.predicate.DepthPredicate
evaluate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodeType

protected final String nodeType
the nodetype to filter on


respectSupertype

protected final boolean respectSupertype
indicates if supertypes should be respected

Constructor Detail

NodeTypePredicate

public NodeTypePredicate(String nodeType,
                         boolean respectSupertype,
                         int minDepth,
                         int maxDepth)
Creates a new node type filter.

Parameters:
nodeType - the node type to filter on
respectSupertype - indicates if supertype should be respected
minDepth - the minimal depth
maxDepth - the maximal depth

NodeTypePredicate

public NodeTypePredicate(String nodeType,
                         boolean respectSupertype)
Creates a new node type filter.

Parameters:
nodeType - the node type to filter on
respectSupertype - indicates if supertype should be respected
Method Detail

matches

protected boolean matches(Item item)
                   throws RepositoryException
Returns true if the item is a node and if the configured nodetype is equal to the primary type of the node. if supertypes are respected it also returns true if the items nodetype extends from the configured node type (Node.isNodeType() check).

Overrides:
matches in class DepthPredicate
Parameters:
item - the item to match
Returns:
true if the item matches; false otherwise.
Throws:
RepositoryException - if an error occurs.
See Also:
DepthPredicate.matches(javax.jcr.Item)


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.