Package org.eclipse.aether.resolution
Class ArtifactResult
- java.lang.Object
-
- org.eclipse.aether.resolution.ArtifactResult
-
public final class ArtifactResult extends java.lang.ObjectThe result of an artifact resolution request.
-
-
Field Summary
Fields Modifier and Type Field Description private Artifactartifactprivate java.util.List<java.lang.Exception>exceptionsprivate ArtifactRepositoryrepositoryprivate ArtifactRequestrequest
-
Constructor Summary
Constructors Constructor Description ArtifactResult(ArtifactRequest request)Creates a new result for the specified request.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ArtifactResultaddException(java.lang.Exception exception)Records the specified exception while resolving the artifact.ArtifactgetArtifact()Gets the resolved artifact (if any).java.util.List<java.lang.Exception>getExceptions()Gets the exceptions that occurred while resolving the artifact.ArtifactRepositorygetRepository()Gets the repository from which the artifact was eventually resolved.ArtifactRequestgetRequest()Gets the resolution request that was made.booleanisMissing()Indicates whether the requested artifact is not present in any of the specified repositories.booleanisResolved()Indicates whether the requested artifact was resolved.ArtifactResultsetArtifact(Artifact artifact)Sets the resolved artifact.ArtifactResultsetRepository(ArtifactRepository repository)Sets the repository from which the artifact was resolved.java.lang.StringtoString()
-
-
-
Field Detail
-
request
private final ArtifactRequest request
-
exceptions
private java.util.List<java.lang.Exception> exceptions
-
artifact
private Artifact artifact
-
repository
private ArtifactRepository repository
-
-
Constructor Detail
-
ArtifactResult
public ArtifactResult(ArtifactRequest request)
Creates a new result for the specified request.- Parameters:
request- The resolution request, must not benull.
-
-
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). UsegetExceptions()to query the errors that occurred while trying to resolve the artifact.- Returns:
- The resolved artifact or
nullif the resolution failed.
-
setArtifact
public ArtifactResult setArtifact(Artifact artifact)
Sets the resolved artifact.- Parameters:
artifact- The resolved artifact, may benullif the resolution failed.- Returns:
- This result for chaining, never
null.
-
getExceptions
public java.util.List<java.lang.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(java.lang.Exception exception)
Records the specified exception while resolving the artifact.- Parameters:
exception- The exception to record, may benull.- 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
nullif 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 benull.- 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 despitegetExceptions()indicating transfer errors while trying to fetch the artifact from some of the specified remote repositories.- Returns:
trueif the artifact was resolved,falseotherwise.- See Also:
Artifact.getFile()
-
isMissing
public boolean isMissing()
Indicates whether the requested artifact is not present in any of the specified repositories.- Returns:
trueif the artifact is not present in any repository,falseotherwise.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-