org.apache.maven.artifact
Class DefaultArtifact

java.lang.Object
  extended by org.apache.maven.artifact.DefaultArtifact
All Implemented Interfaces:
Comparable<Artifact>, Artifact

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

Constructor Detail

DefaultArtifact

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

DefaultArtifact

public DefaultArtifact(String groupId,
                       String artifactId,
                       VersionRange versionRange,
                       String scope,
                       String type,
                       String classifier,
                       ArtifactHandler artifactHandler,
                       boolean optional)
Method Detail

getClassifier

public String getClassifier()
Specified by:
getClassifier in interface Artifact

hasClassifier

public boolean hasClassifier()
Specified by:
hasClassifier in interface Artifact

getScope

public 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 String getGroupId()
Specified by:
getGroupId in interface Artifact

getArtifactId

public String getArtifactId()
Specified by:
getArtifactId in interface Artifact

getVersion

public String getVersion()
Specified by:
getVersion in interface Artifact

setVersion

public void setVersion(String version)
Specified by:
setVersion in interface Artifact

getType

public String getType()
Specified by:
getType in interface Artifact

setFile

public void setFile(File file)
Specified by:
setFile in interface Artifact

getFile

public 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 String getId()
Specified by:
getId in interface Artifact

getDependencyConflictId

public String getDependencyConflictId()
Specified by:
getDependencyConflictId in interface Artifact

addMetadata

public void addMetadata(ArtifactMetadata metadata)
Specified by:
addMetadata in interface Artifact

getMetadata

public ArtifactMetadata getMetadata(Class<?> metadataClass)
Specified by:
getMetadata in interface Artifact

getMetadataList

public Collection<ArtifactMetadata> getMetadataList()
Specified by:
getMetadataList in interface Artifact

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

getBaseVersion

public String getBaseVersion()
Specified by:
getBaseVersion in interface Artifact

getBaseVersionInternal

protected String getBaseVersionInternal()

setBaseVersion

public void setBaseVersion(String baseVersion)
Specified by:
setBaseVersion in interface Artifact

setBaseVersionInternal

protected void setBaseVersionInternal(String baseVersion)

compareTo

public int compareTo(Artifact a)
Specified by:
compareTo in interface Comparable<Artifact>

updateVersion

public void updateVersion(String version,
                          ArtifactRepository localRepository)
Specified by:
updateVersion in interface Artifact

getDownloadUrl

public String getDownloadUrl()
Specified by:
getDownloadUrl in interface Artifact

setDownloadUrl

public void setDownloadUrl(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 List<String> getDependencyTrail()
Specified by:
getDependencyTrail in interface Artifact
Returns:
List < String > with artifact ids

setDependencyTrail

public void setDependencyTrail(List<String> dependencyTrail)
Specified by:
setDependencyTrail in interface Artifact
Parameters:
dependencyTrail - List < String > with artifact ids

setScope

public void setScope(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(String version)
Specified by:
selectVersion in interface Artifact

setGroupId

public void setGroupId(String groupId)
Specified by:
setGroupId in interface Artifact

setArtifactId

public void setArtifactId(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(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 List<ArtifactVersion> getAvailableVersions()
Specified by:
getAvailableVersions in interface Artifact

setAvailableVersions

public void setAvailableVersions(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


Copyright © 2001-2009 The Apache Software Foundation. All Rights Reserved.