Record Class NamesSource

java.lang.Object
java.lang.Record
com.cleanroommc.gradle.api.names.NamesSource

public record NamesSource(String id, Map<String,String> methods, Map<String,String> fields, Map<String,String> params, Map<String,String> docs) extends Record
A resolved set of SRG to name mappings plus a canonical identity string, decoupled from where the names came from (MCP CSVs or a hand-edited Tiny2 file).

The id is the load-bearing part of the mapping-identity feature: patch sets stay at the named (MCP/custom) level and record the id of the names they were generated in, so the pipeline can refuse to apply patches against a base that was named differently. Ids take the form:

  • mcp:<channel>_<version> which is derived from the mcpMappings dependency notation
  • tiny2:<first-12-hex-of-sha256-of-file> which is a sha256 content hash of the Tiny2 file.
  • Constructor Details

    • NamesSource

      public NamesSource(String id, Map<String,String> methods, Map<String,String> fields, Map<String,String> params, Map<String,String> docs)
      Creates an instance of a NamesSource record class.
      Parameters:
      id - the value for the id record component
      methods - the value for the methods record component
      fields - the value for the fields record component
      params - the value for the params record component
      docs - the value for the docs record component
  • Method Details

    • fromTiny2

      public static NamesSource fromTiny2(File tinyFile)
      Resolves a names source from a Tiny2 file.
    • tiny2Id

      public static String tiny2Id(File tinyFile)
    • mcpId

      public static String mcpId(String artifactName, String version)
    • flatNames

      public Map<String,String> flatNames()
      All member and parameter names merged into a single srg -> name lookup, for source renaming.
    • 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.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • methods

      public Map<String,String> methods()
      Returns the value of the methods record component.
      Returns:
      the value of the methods record component
    • fields

      public Map<String,String> fields()
      Returns the value of the fields record component.
      Returns:
      the value of the fields record component
    • params

      public Map<String,String> params()
      Returns the value of the params record component.
      Returns:
      the value of the params record component
    • docs

      public Map<String,String> docs()
      Returns the value of the docs record component.
      Returns:
      the value of the docs record component