Package com.google.javascript.jscomp
Record Class ModuleIdentifier
java.lang.Object
java.lang.Record
com.google.javascript.jscomp.ModuleIdentifier
- Record Components:
name- Returns the user-provided name.closureNamespace- Returns the Closure namespace name.moduleName- Returns the module name.
- All Implemented Interfaces:
Serializable
@Immutable
public record ModuleIdentifier(String name, String closureNamespace, String moduleName)
extends Record
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 Summary
ConstructorsConstructorDescriptionModuleIdentifier(String name, String closureNamespace, String moduleName) Creates an instance of aModuleIdentifierrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theclosureNamespacerecord component.final booleanIndicates whether some other object is "equal to" this one.static ModuleIdentifierforClosure(String name) Returns an identifier for a Closure namespace.static ModuleIdentifierReturns an identifier for an ES or CommonJS module.static ModuleIdentifierforFlagValue(String flagValue) Returns an identifier for an --entry_point flag value.getName()final inthashCode()Returns a hash code value for this object.Returns the value of themoduleNamerecord component.name()Returns the value of thenamerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ModuleIdentifier
Creates an instance of aModuleIdentifierrecord class.- Parameters:
name- the value for thenamerecord componentclosureNamespace- the value for theclosureNamespacerecord componentmoduleName- the value for themoduleNamerecord component
-
-
Method Details
-
getName
-
getClosureNamespace
-
getModuleName
-
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. -
forClosure
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
Returns an identifier for an ES or CommonJS module.- Parameters:
filepath- Path to the ES or CommonJS module.
-
forFlagValue
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.
-
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. -
equals
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 withObjects::equals(Object,Object). -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
closureNamespace
Returns the value of theclosureNamespacerecord component.- Returns:
- the value of the
closureNamespacerecord component
-
moduleName
Returns the value of themoduleNamerecord component.- Returns:
- the value of the
moduleNamerecord component
-