Class ArtifactIdentifier


  • public class ArtifactIdentifier
    extends ManifestIdentifier
    Describes an Artifact identifier, a case-insensitive identification scheme for Artifacts. Format: packageId:artifactId:version Where "version" corresponds to the format described in io.manebot.artifact.Version. Example: com.github.manevolent:ts3j:1.0.0-ba938fd ArtifactIdentifier has a method (fromString) which allows you to parse well-formatted artifact identifiers. Artifact identifiers have three levels of identification: - packageId, a global-scope specifier which isolates Artifacts to specific packages. - artifactId, a package-scope specifier which identifies a particular artifact within a package. - version, a version number associated with the artifact, occasionally containing hexadecimal build fingerprints as well. Artifact identifiers are case-insensitive by nature, and all overloaded Object method adhere to this specification. Due to this, it is safe to use separate but logically equal instances of ArtifactIdentifier in a Map, or dictionary, utilizing hashed keys.
    • Constructor Detail

      • ArtifactIdentifier

        public ArtifactIdentifier​(java.lang.String packageId,
                                  java.lang.String artifactId,
                                  java.lang.String version)
        Constructs a new artifact identifier.
        Parameters:
        packageId - Package ID of the artifact, must not be null.
        artifactId - Artifact ID of the artifact, must not be null.
        version - Version of the artifact, may be null.
    • Method Detail

      • getVersion

        public final java.lang.String getVersion()
        Gets the version associated with this artifact. May be null.
        Returns:
        version.
      • toString

        public java.lang.String toString()
        Converts this artifact identifier to a string. There are two possible formats, depending on the value of version (getVersion()): Version is null: packageId:artifactId Version is not null: packageId:artifactId:version
        Overrides:
        toString in class ManifestIdentifier
        Returns:
        the ArtifactIdentifier's string representation.
      • equals

        public boolean equals​(ArtifactIdentifier b)
        Checks for equality between two ArtifactIdentifiers. When comparing versions, two ArtifactIdentifiers each with a null version are considered equal.
        Parameters:
        b - artifact to check for equality against this artifact identifier.
        Returns:
        true if the artifact identifiers are equal, false otherwise.
      • fromString

        public static ArtifactIdentifier fromString​(java.lang.String string)
        Parses the specified string and converts it into a well-formatted Artifact identifier.
        Parameters:
        string - string to parse.
        Returns:
        ArtifactIdentifier instance representing the specified string.
      • withoutVersion

        public ManifestIdentifier withoutVersion()
        Constructs an anonymized ArtifactIdentifier instance, without the version component.
        Returns:
        ArtifactIdentifier without a version component.