Class JsSourceMatcher

  • All Implemented Interfaces:
    Matcher

    public final class JsSourceMatcher
    extends java.lang.Object
    implements Matcher
    A Matcher that can take arbitrary JS source code and use it as a template to find matches in other source code.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​Node> getTemplateNodeToMatchMap()
      Returns a map from named template node strings to Nodes that were the equivalent matches from the last matched template.
      boolean matches​(Node n, NodeMetadata metadata)
      Returns true if the specified Node and NodeMetadata match the given pattern.
      • Methods inherited from class java.lang.Object

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

      • JsSourceMatcher

        public JsSourceMatcher​(AbstractCompiler compiler,
                               Node templateNode,
                               TypeMatchingStrategy typeMatchingStrategy)
        Constructs this matcher with a Function node that serves as the template to match all other nodes against. The body of the function will be used to match against.
    • Method Detail

      • getTemplateNodeToMatchMap

        public java.util.Map<java.lang.String,​Node> getTemplateNodeToMatchMap()
        Returns a map from named template node strings to Nodes that were the equivalent matches from the last matched template.