Record Class Artifact

java.lang.Object
java.lang.Record
dev.getelements.elements.sdk.record.Artifact
Record Components:
path - the local file system path to the resolved artifact file
group - the Maven groupId
id - the Maven artifactId
version - the artifact version
packaging - the packaging type (jar, war, pom, etc.)
classifier - the optional classifier (may be null)
extension - the file extension

public record Artifact(Path path, String group, String id, String version, String packaging, String classifier, String extension) extends Record
Represents a resolved Maven artifact with its coordinates and local file system path.

This record encapsulates both the Maven coordinates (groupId:artifactId:version:packaging:classifier) and the resolved local path to the artifact file. It is typically used as the result of artifact resolution operations performed by ElementArtifactLoader.

The coordinates follow standard Maven naming conventions:

  • group: Maven groupId (e.g., "org.example")
  • id: Maven artifactId (e.g., "my-library")
  • version: Version string (e.g., "1.0.0")
  • packaging: Packaging type (e.g., "jar", "war", "pom")
  • classifier: Optional classifier (e.g., "sources", "javadoc"), may be null
  • extension: File extension, typically matches packaging but may differ
  • Constructor Details

    • Artifact

      public Artifact(Path path, String group, String id, String version, String packaging, String classifier, String extension)
      Creates an instance of a Artifact record class.
      Parameters:
      path - the value for the path record component
      group - the value for the group record component
      id - the value for the id record component
      version - the value for the version record component
      packaging - the value for the packaging record component
      classifier - the value for the classifier record component
      extension - the value for the extension record component
  • Method Details

    • read

      public InputStream read()
      Opens an InputStream to read the artifact's contents.
      Returns:
      the input stream
    • 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.
    • path

      public Path path()
      Returns the value of the path record component.
      Returns:
      the value of the path record component
    • group

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

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

      public String version()
      Returns the value of the version record component.
      Returns:
      the value of the version record component
    • packaging

      public String packaging()
      Returns the value of the packaging record component.
      Returns:
      the value of the packaging record component
    • classifier

      public String classifier()
      Returns the value of the classifier record component.
      Returns:
      the value of the classifier record component
    • extension

      public String extension()
      Returns the value of the extension record component.
      Returns:
      the value of the extension record component