Class QualifiedName

java.lang.Object
com.google.javascript.rhino.QualifiedName

public abstract class QualifiedName extends Object
Abstraction over a qualified name. Unifies Node-based qualified names and string-based names, allowing to lazily parse strings and represent a pre-parsed qualified name without the overhead of a whole Node. Essentially, a qualified name is a linked list of components, starting from the outermost property access and ending with the root of the name, which is a simple name with no owner.
  • Method Details

    • of

      public static QualifiedName of(String string)
    • getOwner

      public abstract @Nullable QualifiedName getOwner()
      Returns the qualified name of the owner, or null for simple names. For the name "foo.bar.baz", this returns an object representing "foo.bar".
    • getComponent

      public abstract String getComponent()
      Returns outer-most term of this qualified name, or the entire name for simple names. For the name "foo.bar.baz", this returns "baz".
    • isSimple

      public abstract boolean isSimple()
      Returns true if this is a simple name.
    • matches

      public abstract boolean matches(Node n)
      Checks whether the given node matches this name.
    • getRoot

      public String getRoot()
      Returns the root of this name, e.g. "foo" from "foo.bar.baz".
    • components

      public Iterable<String> components()
      Returns the components of this name as an iterable of strings, starting at the root. For the qualified name foo.bar.baz, this returns ["foo", "bar", "baz"].
    • join

      public String join()
      Returns the qualified name as a string.
    • getprop

      public QualifiedName getprop(String propertyName)
      Returns a new qualified name object with this name as the owner and the given string as the property name.