org.eclipse.aether.resolution

## Class ArtifactResult

- java.lang.Object
- - org.eclipse.aether.resolution.ArtifactResult

-     public final class ArtifactResult
      extends Object

  The result of an artifact resolution request.
  See Also:
    `RepositorySystem.resolveArtifacts(RepositorySystemSession, java.util.Collection)`, `Artifact.getFile()`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ArtifactResult(ArtifactRequest request)` Creates a new result for the specified request.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `ArtifactResult` | `addException(Exception exception)` Records the specified exception while resolving the artifact.
    `Artifact` | `getArtifact()` Gets the resolved artifact (if any).
    `List<Exception>` | `getExceptions()` Gets the exceptions that occurred while resolving the artifact.
    `ArtifactRepository` | `getRepository()` Gets the repository from which the artifact was eventually resolved.
    `ArtifactRequest` | `getRequest()` Gets the resolution request that was made.
    `boolean` | `isMissing()` Indicates whether the requested artifact is not present in any of the specified repositories.
    `boolean` | `isResolved()` Indicates whether the requested artifact was resolved.
    `ArtifactResult` | `setArtifact(Artifact artifact)` Sets the resolved artifact.
    `ArtifactResult` | `setRepository(ArtifactRepository repository)` Sets the repository from which the artifact was resolved.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ArtifactResult

          public ArtifactResult(ArtifactRequest request)

      Creates a new result for the specified request.
      Parameters:
        `request` - The resolution request, must not be `null`.

  - ### Method Detail

    - #### getRequest

          public ArtifactRequest getRequest()

      Gets the resolution request that was made.
      Returns:
        The resolution request, never `null`.

    - #### getArtifact

          public Artifact getArtifact()

      Gets the resolved artifact (if any). Use `getExceptions()` to query the errors that occurred while trying to resolve the artifact.
      Returns:
        The resolved artifact or `null` if the resolution failed.

    - #### setArtifact

          public ArtifactResult setArtifact(Artifact artifact)

      Sets the resolved artifact.
      Parameters:
        `artifact` - The resolved artifact, may be `null` if the resolution failed.
      Returns:
        This result for chaining, never `null`.

    - #### getExceptions

          public List<Exception> getExceptions()

      Gets the exceptions that occurred while resolving the artifact. Note that this list can be non-empty even if the artifact was successfully resolved, e.g. when one of the contacted remote repositories didn't contain the artifact but a later repository eventually contained it.
      Returns:
        The exceptions that occurred, never `null`.
      See Also:
        `isResolved()`

    - #### addException

          public ArtifactResult addException(Exception exception)

      Records the specified exception while resolving the artifact.
      Parameters:
        `exception` - The exception to record, may be `null`.
      Returns:
        This result for chaining, never `null`.

    - #### getRepository

          public ArtifactRepository getRepository()

      Gets the repository from which the artifact was eventually resolved. Note that successive resolutions of the same artifact might yield different results if the employed local repository does not track the origin of an artifact.
      Returns:
        The repository from which the artifact was resolved or `null` if unknown.

    - #### setRepository

          public ArtifactResult setRepository(ArtifactRepository repository)

      Sets the repository from which the artifact was resolved.
      Parameters:
        `repository` - The repository from which the artifact was resolved, may be `null`.
      Returns:
        This result for chaining, never `null`.

    - #### isResolved

          public boolean isResolved()

      Indicates whether the requested artifact was resolved. Note that the artifact might have been successfully resolved despite `getExceptions()` indicating transfer errors while trying to fetch the artifact from some of the specified remote repositories.
      Returns:
        `true` if the artifact was resolved, `false` otherwise.
      See Also:
        `Artifact.getFile()`

    - #### isMissing

          public boolean isMissing()

      Indicates whether the requested artifact is not present in any of the specified repositories.
      Returns:
        `true` if the artifact is not present in any repository, `false` otherwise.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2010-2013 The Eclipse Foundation. All Rights Reserved.