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 filegroup- the Maven groupIdid- the Maven artifactIdversion- the artifact versionpackaging- 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theclassifierrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theextensionrecord component.group()Returns the value of thegrouprecord component.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.Returns the value of thepackagingrecord component.path()Returns the value of thepathrecord component.read()Opens anInputStreamto read the artifact's contents.final StringtoString()Returns a string representation of this record class.version()Returns the value of theversionrecord component.
-
Constructor Details
-
Artifact
public Artifact(Path path, String group, String id, String version, String packaging, String classifier, String extension) Creates an instance of aArtifactrecord class.- Parameters:
path- the value for thepathrecord componentgroup- the value for thegrouprecord componentid- the value for theidrecord componentversion- the value for theversionrecord componentpackaging- the value for thepackagingrecord componentclassifier- the value for theclassifierrecord componentextension- the value for theextensionrecord component
-
-
Method Details
-
read
Opens anInputStreamto read the artifact's contents.- Returns:
- the input stream
-
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. -
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). -
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-
group
Returns the value of thegrouprecord component.- Returns:
- the value of the
grouprecord component
-
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
version
Returns the value of theversionrecord component.- Returns:
- the value of the
versionrecord component
-
packaging
Returns the value of thepackagingrecord component.- Returns:
- the value of the
packagingrecord component
-
classifier
Returns the value of theclassifierrecord component.- Returns:
- the value of the
classifierrecord component
-
extension
Returns the value of theextensionrecord component.- Returns:
- the value of the
extensionrecord component
-