Class NodeTypePredicate

  • All Implemented Interfaces:
    Predicate

    public class NodeTypePredicate
    extends DepthPredicate
    Filters on the node type of a node.
    • 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)