Class Link

java.lang.Object
de.sormuras.bach.project.Link
All Implemented Interfaces:
Comparable<Link>

public final class Link
extends Object
implements Comparable<Link>
A link is module-uri pair used to resolve external modules.
  • Constructor Details

  • Method Details

    • ofCentral

      public static Link ofCentral​(String module, String group, String artifact, String version)
      Create a new module link pointing to an artifact hosted at Maven Central.
      Parameters:
      module - The module to used as the nominal part of the pair
      group - Maven Group ID
      artifact - Maven Artifact ID
      version - The version string
      Returns:
      A new Maven Central-based Link instance
      See Also:
      search.maven.org
    • ofCentral

      public static Link ofCentral​(String module, String gav)
      Create a new module link pointing to an artifact hosted at Maven Central.
      Parameters:
      module - The module to used as the nominal part of the pair
      gav - Maven groupId + ':' + artifactId + ':' version [+ ':' + classifier]
      Returns:
      A new Maven Central-based Link instance
      See Also:
      search.maven.org
    • ofJitPack

      public static Link ofJitPack​(String module, String user, String repository, String version)
      Create a new module link pointing to an artifact built by JitPack.
      Parameters:
      module - The module to used as the nominal part of the pair
      user - GitHub username or the complete group like "com.azure.${USER}"
      repository - Name of the repository or project
      version - The version string of the repository or project, which is either a release tag, a commit hash, or "${BRANCH}-SNAPSHOT" for a version that has not been released.
      Returns:
      A new JitPack-based Link instance
      See Also:
      jitpack.io
    • ofJUnitJupiter

      public static Link ofJUnitJupiter​(String suffix, String version)
      Create a new link pointing to a modular JUnit Jupiter JAR file hosted at Maven Central.
      Parameters:
      suffix - The suffix used to complete the module name and the Maven Artifact ID
      version - The version string
      Returns:
      A new Maven Central-based Link instance of JUnit Jupiter
      See Also:
      org.junit.platform[.]$suffix
    • ofJUnitPlatform

      public static Link ofJUnitPlatform​(String suffix, String version)
      Create a new link pointing to a modular JUnit Platform JAR file hosted at Maven Central.
      Parameters:
      suffix - The suffix used to complete the module name and the Maven Artifact ID
      version - The version string
      Returns:
      A new Maven Central-based Link instance of JUnit Platform
      See Also:
      org.junit.platform.$suffix
    • module

      public String module()
    • uri

      public String uri()
    • compareTo

      public int compareTo​(Link other)
      Specified by:
      compareTo in interface Comparable<Link>
    • equals

      public boolean equals​(Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • findFragments

      public List<String> findFragments​(String key)
    • findDigests

      public Map<String,​String> findDigests()
    • findSize

      public Optional<Integer> findSize()
    • findVersion

      public Optional<String> findVersion()
    • toURI

      public URI toURI()
    • toModularJarFileName

      public String toModularJarFileName()
    • withDigest

      public Link withDigest​(String algorithm, String digest)
    • withSize

      public Link withSize​(long size)
    • withVersion

      public Link withVersion​(String version)