Record Class Export

java.lang.Object
java.lang.Record
com.google.javascript.jscomp.modules.Export
Record Components:
exportName - Returns the name of this export or null if this is an export * from.
moduleRequest - Returns the module identifier of an export from or null if this is not an export {} from or export * from.
importName - Returns the name imported from another module. * if import all or null if not an export {} from.
localName - Returns the local name of this export or null if none. *default* if default.
modulePath - Returns the path of the containing module
exportNode - Node that this export originates from. Used for its source location.

Null only if from non-ES module or from a missing ES module.

nameNode - Node that this export originates from. Used for its source location.

Null only if from non-ES6 module or an export syntax that has no associated name, e.g. export * from.

moduleMetadata - The module that contains this export.
mutated - Whether or not this export is potentially mutated after module execution (i.e. in a function scope).

public record Export(@Nullable String exportName, @Nullable String moduleRequest, @Nullable String importName, @Nullable String localName, @Nullable ModuleLoader.ModulePath modulePath, @Nullable Node exportNode, @Nullable Node nameNode, ModuleMetadataMap.ModuleMetadata moduleMetadata, @Nullable String closureNamespace, boolean mutated) extends Record
An exported name in a module.

See the ExportEntry in the ECMAScript spec.

  • Field Details

    • DEFAULT_EXPORT_NAME

      public static final String DEFAULT_EXPORT_NAME
      The localName() of anonymous ES module default exports, e.g. export default 0.
      See Also:
    • NAMESPACE

      public static final String NAMESPACE
      The exportName() of goog.module default exports, e.g. exports = class {};, and the 'namespace' of an ES module consisting of all exported names.
      See Also:
  • Constructor Details

    • Export

      public Export(@Nullable String exportName, @Nullable String moduleRequest, @Nullable String importName, @Nullable String localName, @Nullable ModuleLoader.ModulePath modulePath, @Nullable Node exportNode, @Nullable Node nameNode, ModuleMetadataMap.ModuleMetadata moduleMetadata, @Nullable String closureNamespace, boolean mutated)
      Creates an instance of a Export record class.
      Parameters:
      exportName - the value for the exportName record component
      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
      exportNode - the value for the exportNode record component
      nameNode - the value for the nameNode record component
      moduleMetadata - the value for the moduleMetadata record component
      closureNamespace - the value for the closureNamespace record component
      mutated - the value for the mutated 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • exportName

      public @Nullable String exportName()
      Returns the value of the exportName record component.
      Returns:
      the value of the exportName record component
    • moduleRequest

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

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

      public @Nullable 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
    • exportNode

      public @Nullable Node exportNode()
      Returns the value of the exportNode record component.
      Returns:
      the value of the exportNode record component
    • nameNode

      public @Nullable Node nameNode()
      Returns the value of the nameNode record component.
      Returns:
      the value of the nameNode record component
    • moduleMetadata

      public ModuleMetadataMap.ModuleMetadata moduleMetadata()
      Returns the value of the moduleMetadata record component.
      Returns:
      the value of the moduleMetadata record component
    • closureNamespace

      public @Nullable String closureNamespace()
      Returns the value of the closureNamespace record component.
      Returns:
      the value of the closureNamespace record component
    • mutated

      public boolean mutated()
      Returns the value of the mutated record component.
      Returns:
      the value of the mutated record component