Record Class Import

java.lang.Object
java.lang.Record
com.google.javascript.jscomp.modules.Import
Record Components:
moduleRequest - Returns the module identifier of this import.
importName - Returns the name that was imported from the requested module.

For import * this will return "*".

localName - Returns the local name the imported value is bound to.
modulePath - Returns the path of the containing module, if from an ES module.
importNode - Returns the import node for source information.
nameNode - Returns the name node for source information.

public record Import(String moduleRequest, String importName, String localName, @Nullable ModuleLoader.ModulePath modulePath, Node importNode, Node nameNode) extends Record
An imported name in a module.

See the ImportEntry in the ECMAScript spec.

  • Constructor Details

    • Import

      public Import(String moduleRequest, String importName, String localName, @Nullable ModuleLoader.ModulePath modulePath, Node importNode, Node nameNode)
      Creates an instance of a Import record class.
      Parameters:
      moduleRequest - the value for the moduleRequest record component
      importName - the value for the importName record component
      localName - the value for the localName record component
      modulePath - the value for the modulePath record component
      importNode - the value for the importNode record component
      nameNode - the value for the nameNode record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • moduleRequest

      public String moduleRequest()
      Returns the value of the moduleRequest record component.
      Returns:
      the value of the moduleRequest record component
    • importName

      public String importName()
      Returns the value of the importName record component.
      Returns:
      the value of the importName record component
    • localName

      public String localName()
      Returns the value of the localName record component.
      Returns:
      the value of the localName record component
    • modulePath

      public @Nullable ModuleLoader.ModulePath modulePath()
      Returns the value of the modulePath record component.
      Returns:
      the value of the modulePath record component
    • importNode

      public Node importNode()
      Returns the value of the importNode record component.
      Returns:
      the value of the importNode record component
    • nameNode

      public Node nameNode()
      Returns the value of the nameNode record component.
      Returns:
      the value of the nameNode record component