Record Class Dependency

java.lang.Object
java.lang.Record
io.github.slimjar.resolver.data.Dependency
All Implemented Interfaces:
Comparable<Dependency>

public record Dependency(@NotNull String groupId, @NotNull String artifactId, @NotNull String version, @Nullable String snapshotId, @NotNull Collection<Dependency> transitive) extends Record implements Comparable<Dependency>
  • Constructor Details

    • Dependency

      public Dependency(@NotNull @NotNull String groupId, @NotNull @NotNull String artifactId, @NotNull @NotNull String version, @Nullable @Nullable String snapshotId, @NotNull @NotNull Collection<Dependency> transitive)
      Creates an instance of a Dependency record class.
      Parameters:
      groupId - the value for the groupId record component
      artifactId - the value for the artifactId record component
      version - the value for the version record component
      snapshotId - the value for the snapshotId record component
      transitive - the value for the transitive record component
  • Method Details

    • read

      @NotNull @Contract(pure=true) public static @NotNull Dependency read(@NotNull @NotNull DataInput in) throws IOException
      Throws:
      IOException
    • isSnapshot

      public boolean isSnapshot()
    • snapshot

      public Optional<String> snapshot()
    • write

      public void write(@NotNull @NotNull DataOutput out) throws IOException
      Throws:
      IOException
    • toString

      @Contract(pure=true) @NotNull public @NotNull 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
    • equals

      @Contract(value="null -> false", pure=true) public boolean equals(@Nullable @Nullable 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.
    • hashCode

      @Contract(pure=true) public 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
    • compareTo

      @Contract(pure=true) public int compareTo(@NotNull @NotNull Dependency o) throws NotComparableDependencyException
      Specified by:
      compareTo in interface Comparable<Dependency>
      Throws:
      NotComparableDependencyException
    • groupId

      @NotNull public @NotNull String groupId()
      Returns the value of the groupId record component.
      Returns:
      the value of the groupId record component
    • artifactId

      @NotNull public @NotNull String artifactId()
      Returns the value of the artifactId record component.
      Returns:
      the value of the artifactId record component
    • version

      @NotNull public @NotNull String version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • snapshotId

      @Nullable public @Nullable String snapshotId()
      Returns the value of the snapshotId record component.
      Returns:
      the value of the snapshotId record component
    • transitive

      @NotNull public @NotNull Collection<Dependency> transitive()
      Returns the value of the transitive record component.
      Returns:
      the value of the transitive record component