org.apache.maven.artifact

## Class DefaultArtifact

- java.lang.Object
- - org.apache.maven.artifact.DefaultArtifact

All Implemented Interfaces:
  java.lang.Comparable<Artifact>, Artifact

Direct Known Subclasses:
  AttachedArtifact

    public class DefaultArtifact
    extends java.lang.Object
    implements Artifact

Version:
  $Id: DefaultArtifact.java 767322 2009-04-21 22:52:54Z jdcasey $
Author:
  Jason van Zyl

### Field Summary

### Fields inherited from interface org.apache.maven.artifact.Artifact

`LATEST_VERSION, RELEASE_VERSION, SCOPE_COMPILE, SCOPE_IMPORT, SCOPE_PROVIDED, SCOPE_RUNTIME, SCOPE_SYSTEM, SCOPE_TEST, SNAPSHOT_VERSION, VERSION_FILE_PATTERN`

### Constructor Summary

Constructors
Constructor and Description
`DefaultArtifact(java.lang.String groupId, java.lang.String artifactId, VersionRange versionRange, java.lang.String scope, java.lang.String type, java.lang.String classifier, ArtifactHandler artifactHandler)`
`DefaultArtifact(java.lang.String groupId, java.lang.String artifactId, VersionRange versionRange, java.lang.String scope, java.lang.String type, java.lang.String classifier, ArtifactHandler artifactHandler, boolean optional)`

### Method Summary

Methods
`void` `addMetadata(ArtifactMetadata metadata)`
`int` `compareTo(Artifact a)`
`boolean` `equals(java.lang.Object o)`
`ArtifactHandler` `getArtifactHandler()`
`java.lang.String` `getArtifactId()`
`java.util.List<ArtifactVersion>` `getAvailableVersions()`
`java.lang.String` `getBaseVersion()`
`protected java.lang.String` `getBaseVersionInternal()`
`java.lang.String` `getClassifier()`
`java.lang.String` `getDependencyConflictId()`
`ArtifactFilter` `getDependencyFilter()`
`java.util.List<java.lang.String>` `getDependencyTrail()`
`java.lang.String` `getDownloadUrl()`
`java.io.File` `getFile()`
`java.lang.String` `getGroupId()`
`java.lang.String` `getId()`
`ArtifactMetadata` `getMetadata(java.lang.Class<?> metadataClass)`
`java.util.Collection<ArtifactMetadata>` `getMetadataList()`
`ArtifactRepository` `getRepository()`
`java.lang.String` `getScope()` Get the scope of the artifact.
`ArtifactVersion` `getSelectedVersion()`
`java.lang.String` `getType()`
`java.lang.String` `getVersion()`
`VersionRange` `getVersionRange()`
`boolean` `hasClassifier()`
`int` `hashCode()`
`boolean` `isOptional()`
`boolean` `isRelease()`
`boolean` `isResolved()`
`boolean` `isSelectedVersionKnown()`
`boolean` `isSnapshot()`
`void` `selectVersion(java.lang.String version)`
`void` `setArtifactHandler(ArtifactHandler artifactHandler)`
`void` `setArtifactId(java.lang.String artifactId)`
`void` `setAvailableVersions(java.util.List<ArtifactVersion> availableVersions)`
`void` `setBaseVersion(java.lang.String baseVersion)`
`protected void` `setBaseVersionInternal(java.lang.String baseVersion)`
`void` `setDependencyFilter(ArtifactFilter artifactFilter)`
`void` `setDependencyTrail(java.util.List<java.lang.String> dependencyTrail)`
`void` `setDownloadUrl(java.lang.String downloadUrl)`
`void` `setFile(java.io.File file)`
`void` `setGroupId(java.lang.String groupId)`
`void` `setOptional(boolean optional)`
`void` `setRelease(boolean release)`
`void` `setRepository(ArtifactRepository repository)`
`void` `setResolved(boolean resolved)`
`void` `setResolvedVersion(java.lang.String version)`
`void` `setScope(java.lang.String scope)`
`void` `setVersion(java.lang.String version)`
`void` `setVersionRange(VersionRange versionRange)`
`java.lang.String` `toString()`
`void` `updateVersion(java.lang.String version, ArtifactRepository localRepository)`

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

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

### Constructor Detail

#### DefaultArtifact

    public DefaultArtifact(java.lang.String groupId,
                   java.lang.String artifactId,
                   VersionRange versionRange,
                   java.lang.String scope,
                   java.lang.String type,
                   java.lang.String classifier,
                   ArtifactHandler artifactHandler)

#### DefaultArtifact

    public DefaultArtifact(java.lang.String groupId,
                   java.lang.String artifactId,
                   VersionRange versionRange,
                   java.lang.String scope,
                   java.lang.String type,
                   java.lang.String classifier,
                   ArtifactHandler artifactHandler,
                   boolean optional)

### Method Detail

#### getClassifier

    public java.lang.String getClassifier()

Specified by:
  `getClassifier` in interface `Artifact`

#### hasClassifier

    public boolean hasClassifier()

Specified by:
  `hasClassifier` in interface `Artifact`

#### getScope

    public java.lang.String getScope()

Description copied from interface: `Artifact`
Get the scope of the artifact. If the artifact is a standalone rather than a dependency, it's scope will be `null`. The scope may not be the same as it was declared on the original dependency, as this is the result of combining it with the main project scope.

Specified by:
  `getScope` in interface `Artifact`
Returns:
  the scope

#### getGroupId

    public java.lang.String getGroupId()

Specified by:
  `getGroupId` in interface `Artifact`

#### getArtifactId

    public java.lang.String getArtifactId()

Specified by:
  `getArtifactId` in interface `Artifact`

#### getVersion

    public java.lang.String getVersion()

Specified by:
  `getVersion` in interface `Artifact`

#### setVersion

    public void setVersion(java.lang.String version)

Specified by:
  `setVersion` in interface `Artifact`

#### getType

    public java.lang.String getType()

Specified by:
  `getType` in interface `Artifact`

#### setFile

    public void setFile(java.io.File file)

Specified by:
  `setFile` in interface `Artifact`

#### getFile

    public java.io.File getFile()

Specified by:
  `getFile` in interface `Artifact`

#### getRepository

    public ArtifactRepository getRepository()

Specified by:
  `getRepository` in interface `Artifact`

#### setRepository

    public void setRepository(ArtifactRepository repository)

Specified by:
  `setRepository` in interface `Artifact`

#### getId

    public java.lang.String getId()

Specified by:
  `getId` in interface `Artifact`

#### getDependencyConflictId

    public java.lang.String getDependencyConflictId()

Specified by:
  `getDependencyConflictId` in interface `Artifact`

#### addMetadata

    public void addMetadata(ArtifactMetadata metadata)

Specified by:
  `addMetadata` in interface `Artifact`

#### getMetadata

    public ArtifactMetadata getMetadata(java.lang.Class<?> metadataClass)

Specified by:
  `getMetadata` in interface `Artifact`

#### getMetadataList

    public java.util.Collection<ArtifactMetadata> getMetadataList()

Specified by:
  `getMetadataList` in interface `Artifact`

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `java.lang.Object`

#### equals

    public boolean equals(java.lang.Object o)

Overrides:
  `equals` in class `java.lang.Object`

#### getBaseVersion

    public java.lang.String getBaseVersion()

Specified by:
  `getBaseVersion` in interface `Artifact`

#### getBaseVersionInternal

    protected java.lang.String getBaseVersionInternal()

#### setBaseVersion

    public void setBaseVersion(java.lang.String baseVersion)

Specified by:
  `setBaseVersion` in interface `Artifact`

#### setBaseVersionInternal

    protected void setBaseVersionInternal(java.lang.String baseVersion)

#### compareTo

    public int compareTo(Artifact a)

Specified by:
  `compareTo` in interface `java.lang.Comparable<Artifact>`

#### updateVersion

    public void updateVersion(java.lang.String version,
                     ArtifactRepository localRepository)

Specified by:
  `updateVersion` in interface `Artifact`

#### getDownloadUrl

    public java.lang.String getDownloadUrl()

Specified by:
  `getDownloadUrl` in interface `Artifact`

#### setDownloadUrl

    public void setDownloadUrl(java.lang.String downloadUrl)

Specified by:
  `setDownloadUrl` in interface `Artifact`

#### getDependencyFilter

    public ArtifactFilter getDependencyFilter()

Specified by:
  `getDependencyFilter` in interface `Artifact`

#### setDependencyFilter

    public void setDependencyFilter(ArtifactFilter artifactFilter)

Specified by:
  `setDependencyFilter` in interface `Artifact`

#### getArtifactHandler

    public ArtifactHandler getArtifactHandler()

Specified by:
  `getArtifactHandler` in interface `Artifact`

#### getDependencyTrail

    public java.util.List<java.lang.String> getDependencyTrail()

Specified by:
  `getDependencyTrail` in interface `Artifact`
Returns:
  `List` < `String` > with artifact ids

#### setDependencyTrail

    public void setDependencyTrail(java.util.List<java.lang.String> dependencyTrail)

Specified by:
  `setDependencyTrail` in interface `Artifact`
Parameters:
  `dependencyTrail` - `List` < `String` > with artifact ids

#### setScope

    public void setScope(java.lang.String scope)

Specified by:
  `setScope` in interface `Artifact`

#### getVersionRange

    public VersionRange getVersionRange()

Specified by:
  `getVersionRange` in interface `Artifact`

#### setVersionRange

    public void setVersionRange(VersionRange versionRange)

Specified by:
  `setVersionRange` in interface `Artifact`

#### selectVersion

    public void selectVersion(java.lang.String version)

Specified by:
  `selectVersion` in interface `Artifact`

#### setGroupId

    public void setGroupId(java.lang.String groupId)

Specified by:
  `setGroupId` in interface `Artifact`

#### setArtifactId

    public void setArtifactId(java.lang.String artifactId)

Specified by:
  `setArtifactId` in interface `Artifact`

#### isSnapshot

    public boolean isSnapshot()

Specified by:
  `isSnapshot` in interface `Artifact`

#### setResolved

    public void setResolved(boolean resolved)

Specified by:
  `setResolved` in interface `Artifact`

#### isResolved

    public boolean isResolved()

Specified by:
  `isResolved` in interface `Artifact`

#### setResolvedVersion

    public void setResolvedVersion(java.lang.String version)

Specified by:
  `setResolvedVersion` in interface `Artifact`

#### setArtifactHandler

    public void setArtifactHandler(ArtifactHandler artifactHandler)

Specified by:
  `setArtifactHandler` in interface `Artifact`

#### setRelease

    public void setRelease(boolean release)

Specified by:
  `setRelease` in interface `Artifact`

#### isRelease

    public boolean isRelease()

Specified by:
  `isRelease` in interface `Artifact`

#### getAvailableVersions

    public java.util.List<ArtifactVersion> getAvailableVersions()

Specified by:
  `getAvailableVersions` in interface `Artifact`

#### setAvailableVersions

    public void setAvailableVersions(java.util.List<ArtifactVersion> availableVersions)

Specified by:
  `setAvailableVersions` in interface `Artifact`

#### isOptional

    public boolean isOptional()

Specified by:
  `isOptional` in interface `Artifact`

#### getSelectedVersion

    public ArtifactVersion getSelectedVersion()
                                       throws OverConstrainedVersionException

Specified by:
  `getSelectedVersion` in interface `Artifact`
Throws:
  `OverConstrainedVersionException`

#### isSelectedVersionKnown

    public boolean isSelectedVersionKnown()
                                   throws OverConstrainedVersionException

Specified by:
  `isSelectedVersionKnown` in interface `Artifact`
Throws:
  `OverConstrainedVersionException`

#### setOptional

    public void setOptional(boolean optional)

Specified by:
  `setOptional` in interface `Artifact`