org.sonatype.aether.util.artifact
Class SubArtifact

java.lang.Object
  extended by org.sonatype.aether.util.artifact.AbstractArtifact
      extended by org.sonatype.aether.util.artifact.SubArtifact
All Implemented Interfaces:
Artifact

public final class SubArtifact
extends AbstractArtifact

An artifact whose identity is derived from another artifact. Note: Instances of this class are immutable and the exposed mutators return new objects rather than changing the current instance.

Author:
Benjamin Bentmann

Constructor Summary
SubArtifact(Artifact mainArtifact, String classifier, String extension)
          Creates a new sub artifact.
SubArtifact(Artifact mainArtifact, String classifier, String extension, File file)
          Creates a new sub artifact.
SubArtifact(Artifact mainArtifact, String classifier, String extension, Map<String,String> properties)
          Creates a new sub artifact.
SubArtifact(Artifact mainArtifact, String classifier, String extension, Map<String,String> properties, File file)
          Creates a new sub artifact.
 
Method Summary
 String getArtifactId()
           
 String getBaseVersion()
           
 String getClassifier()
           
 String getExtension()
           
 File getFile()
           
 String getGroupId()
           
 Map<String,String> getProperties()
           
 String getProperty(String key, String defaultValue)
           
 String getVersion()
           
 boolean isSnapshot()
           
 Artifact setFile(File file)
           
 Artifact setProperties(Map<String,String> properties)
           
 Artifact setVersion(String version)
           
 
Methods inherited from class org.sonatype.aether.util.artifact.AbstractArtifact
equals, hashCode, isSnapshot, newInstance, toBaseVersion, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SubArtifact

public SubArtifact(Artifact mainArtifact,
                   String classifier,
                   String extension)
Creates a new sub artifact. The classifier and extension specified for this artifact may use the asterisk character "*" to refer to the corresponding property of the main artifact. For instance, the classifier "*-sources" can be used to refer to the source attachment of an artifact. Likewise, the extension "*.asc" can be used to refer to the GPG signature of an artifact.

Parameters:
mainArtifact - The artifact from which to derive the identity, must not be null.
classifier - The classifier for this artifact, may be null if none.
extension - The extension for this artifact, may be null if none.

SubArtifact

public SubArtifact(Artifact mainArtifact,
                   String classifier,
                   String extension,
                   File file)
Creates a new sub artifact. The classifier and extension specified for this artifact may use the asterisk character "*" to refer to the corresponding property of the main artifact. For instance, the classifier "*-sources" can be used to refer to the source attachment of an artifact. Likewise, the extension "*.asc" can be used to refer to the GPG signature of an artifact.

Parameters:
mainArtifact - The artifact from which to derive the identity, must not be null.
classifier - The classifier for this artifact, may be null if none.
extension - The extension for this artifact, may be null if none.
file - The file for this artifact, may be null if unresolved.

SubArtifact

public SubArtifact(Artifact mainArtifact,
                   String classifier,
                   String extension,
                   Map<String,String> properties)
Creates a new sub artifact. The classifier and extension specified for this artifact may use the asterisk character "*" to refer to the corresponding property of the main artifact. For instance, the classifier "*-sources" can be used to refer to the source attachment of an artifact. Likewise, the extension "*.asc" can be used to refer to the GPG signature of an artifact.

Parameters:
mainArtifact - The artifact from which to derive the identity, must not be null.
classifier - The classifier for this artifact, may be null if none.
extension - The extension for this artifact, may be null if none.
properties - The properties of the artifact, may be null.

SubArtifact

public SubArtifact(Artifact mainArtifact,
                   String classifier,
                   String extension,
                   Map<String,String> properties,
                   File file)
Creates a new sub artifact. The classifier and extension specified for this artifact may use the asterisk character "*" to refer to the corresponding property of the main artifact. For instance, the classifier "*-sources" can be used to refer to the source attachment of an artifact. Likewise, the extension "*.asc" can be used to refer to the GPG signature of an artifact.

Parameters:
mainArtifact - The artifact from which to derive the identity, must not be null.
classifier - The classifier for this artifact, may be null if none.
extension - The extension for this artifact, may be null if none.
properties - The properties of the artifact, may be null.
file - The file for this artifact, may be null if unresolved.
Method Detail

getGroupId

public String getGroupId()

getArtifactId

public String getArtifactId()

getVersion

public String getVersion()

setVersion

public Artifact setVersion(String version)
Specified by:
setVersion in interface Artifact
Overrides:
setVersion in class AbstractArtifact

getBaseVersion

public String getBaseVersion()

isSnapshot

public boolean isSnapshot()

getClassifier

public String getClassifier()

getExtension

public String getExtension()

getFile

public File getFile()

setFile

public Artifact setFile(File file)
Specified by:
setFile in interface Artifact
Overrides:
setFile in class AbstractArtifact

getProperty

public String getProperty(String key,
                          String defaultValue)

getProperties

public Map<String,String> getProperties()

setProperties

public Artifact setProperties(Map<String,String> properties)
Specified by:
setProperties in interface Artifact
Overrides:
setProperties in class AbstractArtifact


Copyright © 2010-2011 Sonatype, Inc.. All Rights Reserved.