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 aModuleIdentifier
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theclosureNamespace
record component.final boolean
Indicates whether some other object is "equal to" this one.static ModuleIdentifier
forClosure
(String name) Returns an identifier for a Closure namespace.static ModuleIdentifier
Returns an identifier for an ES or CommonJS module.static ModuleIdentifier
forFlagValue
(String flagValue) Returns an identifier for an --entry_point flag value.getName()
final int
hashCode()
Returns a hash code value for this object.Returns the value of themoduleName
record component.name()
Returns the value of thename
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
ModuleIdentifier
Creates an instance of aModuleIdentifier
record class.- Parameters:
name
- the value for thename
record componentclosureNamespace
- the value for theclosureNamespace
record componentmoduleName
- the value for themoduleName
record 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 thename
record component.- Returns:
- the value of the
name
record component
-
closureNamespace
Returns the value of theclosureNamespace
record component.- Returns:
- the value of the
closureNamespace
record component
-
moduleName
Returns the value of themoduleName
record component.- Returns:
- the value of the
moduleName
record component
-