Record Class DependencyMetadata

java.lang.Object
java.lang.Record
io.github.smootheez.modrinth.DependencyMetadata
Record Components:
projectId - The unique identifier or slug of the dependent project, as recognized by the remote platform. Annotated with project_id for correct JSON mapping.
dependencyType - The relationship type between this project and the dependency, defining whether it is required, optional, incompatible, or has other semantics. Annotated with dependency_type for JSON mapping.

public record DependencyMetadata(String projectId, DependencyType dependencyType) extends Record
Represents a single dependency entry used when publishing metadata to external mod distribution platforms such as CurseForge or Modrinth.

This record models the relationship between the current project and another referenced project, typically used to express requirements such as:

  • required dependencies
  • optional dependencies
  • embedded libraries
  • tooling or compatibility addons

The values here are serialized to JSON using Gson and included as part of the upload request payload.

  • Constructor Details

    • DependencyMetadata

      public DependencyMetadata(String projectId, DependencyType dependencyType)
      Creates an instance of a DependencyMetadata record class.
      Parameters:
      projectId - the value for the projectId record component
      dependencyType - the value for the dependencyType 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. 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.
    • projectId

      @SerializedName("project_id") public String projectId()
      Returns the value of the projectId record component.
      Returns:
      the value of the projectId record component
    • dependencyType

      @SerializedName("dependency_type") public DependencyType dependencyType()
      Returns the value of the dependencyType record component.
      Returns:
      the value of the dependencyType record component