Package com.google.javascript.rhino
Class QualifiedName
- java.lang.Object
-
- com.google.javascript.rhino.QualifiedName
-
public abstract class QualifiedName extends java.lang.ObjectAbstraction 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 Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.Iterable<java.lang.String>components()Returns the components of this name as an iterable of strings, starting at the root.abstract java.lang.StringgetComponent()Returns outer-most term of this qualified name, or the entire name for simple names.abstract QualifiedNamegetOwner()Returns the qualified name of the owner, or null for simple names.QualifiedNamegetprop(java.lang.String propertyName)Returns a new qualified name object withthisname as the owner and the given string as the property name.java.lang.StringgetRoot()Returns the root of this name, e.g.abstract booleanisSimple()Returns true if this is a simple name.java.lang.Stringjoin()Returns the qualified name as a string.abstract booleanmatches(Node n)Checks whether the given node matches this name.static QualifiedNameof(java.lang.String string)
-
-
-
Method Detail
-
of
public static QualifiedName of(java.lang.String string)
-
getOwner
@Nullable public abstract 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 java.lang.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 java.lang.String getRoot()
Returns the root of this name, e.g. "foo" from "foo.bar.baz".
-
components
public java.lang.Iterable<java.lang.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 java.lang.String join()
Returns the qualified name as a string.
-
getprop
public QualifiedName getprop(java.lang.String propertyName)
Returns a new qualified name object withthisname as the owner and the given string as the property name.
-
-