Class AbstractXPathRuleQuery

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract java.util.List<Node> evaluate​(Node node, RuleContext data)
      Evaluate the XPath query against the given Node.
      java.util.List<java.lang.String> getRuleChainVisits()
      Indicates which AST Nodes (if any) should be used with the RuleChain.
      protected abstract boolean isSupportedVersion​(java.lang.String version)
      Subclasses should implement to indicate whether an XPath version is supported.
      void setProperties​(java.util.Map<PropertyDescriptor<?>,​java.lang.Object> properties)
      Set the properties to use during the XPath query.
      void setVersion​(java.lang.String version)
      Set the XPath version to be used.
      void setXPath​(java.lang.String xpath)
      Set the XPath query string to be used.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • xpath

        protected java.lang.String xpath
        The XPath query string.
      • version

        protected java.lang.String version
        The XPath version;
      • properties

        protected java.util.Map<PropertyDescriptor<?>,​java.lang.Object> properties
        The properties.
      • ruleChainVisits

        protected final java.util.List<java.lang.String> ruleChainVisits
        Subclasses can manage RuleChain visits via this list.
    • Constructor Detail

      • AbstractXPathRuleQuery

        public AbstractXPathRuleQuery()
    • Method Detail

      • setXPath

        public void setXPath​(java.lang.String xpath)
        Description copied from interface: XPathRuleQuery
        Set the XPath query string to be used.
        Specified by:
        setXPath in interface XPathRuleQuery
        Parameters:
        xpath - The XPath query string.
      • setVersion

        public void setVersion​(java.lang.String version)
                        throws java.lang.UnsupportedOperationException
        Description copied from interface: XPathRuleQuery
        Set the XPath version to be used.
        Specified by:
        setVersion in interface XPathRuleQuery
        Parameters:
        version - The XPath version.
        Throws:
        java.lang.UnsupportedOperationException - if the version cannot be handled.
      • isSupportedVersion

        protected abstract boolean isSupportedVersion​(java.lang.String version)
        Subclasses should implement to indicate whether an XPath version is supported.
        Parameters:
        version - The XPath version.
        Returns:
        true if the XPath version is supported, false otherwise.
      • getRuleChainVisits

        public java.util.List<java.lang.String> getRuleChainVisits()
        Description copied from interface: XPathRuleQuery
        Indicates which AST Nodes (if any) should be used with the RuleChain. Use of the RuleChain will allow the query execute on a targed sub-tree of the AST, instead of the entire AST from the root. This can result in great performance benefits.
        Specified by:
        getRuleChainVisits in interface XPathRuleQuery
      • evaluate

        public abstract java.util.List<Node> evaluate​(Node node,
                                                      RuleContext data)
        Description copied from interface: XPathRuleQuery
        Evaluate the XPath query against the given Node.
        Specified by:
        evaluate in interface XPathRuleQuery
        Parameters:
        node - The Node.
        data - The RuleContext.
        Returns:
        The matching Nodes.