Class ModuleIdentifier

java.lang.Object
com.google.javascript.jscomp.ModuleIdentifier
All Implemented Interfaces:
Serializable

@Immutable public abstract class ModuleIdentifier extends Object implements Serializable
Basic information on an entry point module.

Closure entry points are namespace names, while ES and CommonJS entry points are file paths which are normalized to a namespace name.

This class allows error messages to be based on the user-provided name rather than the normalized name.

See Also:
  • Constructor Details

    • ModuleIdentifier

      public ModuleIdentifier()
  • Method Details

    • getName

      public abstract String getName()
      Returns the user-provided name.
    • getClosureNamespace

      public abstract String getClosureNamespace()
      Returns the Closure namespace name.
    • getModuleName

      public abstract String getModuleName()
      Returns the module name.
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • forClosure

      public static ModuleIdentifier forClosure(String name)
      Returns an identifier for a Closure namespace.
      Parameters:
      name - The Closure namespace. It may be in one of the formats `name.space`, `goog:name.space` or `goog:moduleName:name.space`, where the latter specifies that the module and namespace names are different.
    • forFile

      public static ModuleIdentifier forFile(String filepath)
      Returns an identifier for an ES or CommonJS module.
      Parameters:
      filepath - Path to the ES or CommonJS module.
    • forFlagValue

      public static ModuleIdentifier forFlagValue(String flagValue)
      Returns an identifier for an --entry_point flag value.
      Parameters:
      flagValue - The flag value. If it is in one of the formats `goog:name.space` or `goog:moduleName:name.space`, it is interpreted as a Closure namespace. Otherwise, it is interpreted as the path to an ES or CommonJS module.