Class RepositoryAttachedValue<V>

java.lang.Object
org.stianloader.picoresolve.repo.RepositoryAttachedValue<V>
Type Parameters:
V - The type of the value

public class RepositoryAttachedValue<V> extends Object
A RepositoryAttachedValue is - as it's name implies - a value that is attached to a repository. As of now it is used the file downloading and repository negotiation process. The main purpose for this class is to be able to trace the source repositories of artifacts.

Beware that it is permitted for the value to be attached to a null repository. In this case, the value is considered to be attached to no particular repository and may have directly been installed to the local maven repository. However, RepositoryNegotiatior implementations should store adequate metadata to be able to "track" from which repository an artifact came from even across executions if the artifact was downloaded from a remote repository.

  • Constructor Details

    • RepositoryAttachedValue

      public RepositoryAttachedValue(@Nullable @Nullable MavenRepository repository, @NotNull V value)
  • Method Details

    • getValue

      @NotNull @Contract(pure=true) public V getValue()
      Obtains the value stored by this object. May not return null as that is not sensical.
      Returns:
      The attached value
    • getRepository

      @Nullable @Contract(pure=true) public @Nullable MavenRepository getRepository()
      Obtains the MavenRepository which is linked to the value. In practice this is the repository where a file originates from, may be null to indicate that this comes from MavenLocal - possibly installed by user interaction. Do note that most artifacts cached in MavenLocal should not return null but instead the repository where they were originally coming from. Furthermore this value should not return null if this object was created by any instance of MavenRepository.

      It is also permitted to use null repositories if the repository the value originates from is known, but not registered to the negotiator (or whichever other object emits this RepositoryAttachedValue). This for example can by reproduced by altering the ID of a repository across executions, rendering repository tracking metadata insufficient. Note: implementations are allowed to fall back to using the URL of the repository instead. That being said, solely relying on the ID is sufficient for most uses.

      Returns:
      The repository.