Class NodePredicateLambda

java.lang.Object
net.sf.saxon.pattern.NodePredicateLambda
All Implemented Interfaces:
NodePredicate

public class NodePredicateLambda extends Object implements NodePredicate
A NodePredicate that wraps a general predicate applied to nodes.

This is needed for C#, where it is not possible for a method to accept either a NodeTest object or a Predicate supplied as a lambda expression. To supply a predicate, it is therefore necessary to wrap it in a NodePredicateLambda.

In SaxonJ the class is never instantiated, because the factory method of(Predicate) returns a NodePredicate

  • Method Details

    • of

      public static NodePredicate of(Predicate<? super GNode> predicate)
      Create a NodeTest based on a supplied predicate. The NodeTest selects a node if the predicate returns true.
      Parameters:
      predicate - the supplied predicate (a boolean function of a node)
      Returns:
      a NodeTest matching the selected nodes
    • test

      public boolean test(GNode node)
      Specified by:
      test in interface NodePredicate