org.sonatype.aether.test.util.impl
Class StubArtifact

java.lang.Object
  extended by org.sonatype.aether.test.util.impl.StubArtifact
All Implemented Interfaces:
Artifact

public class StubArtifact
extends java.lang.Object
implements Artifact

Author:
Benjamin Bentmann

Constructor Summary
StubArtifact(java.lang.String coords)
           
StubArtifact(java.lang.String coords, java.util.Map<java.lang.String,java.lang.String> properties)
           
StubArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String classifier, java.lang.String extension, java.lang.String version)
           
StubArtifact(java.lang.String groupId, java.lang.String artifactId, java.lang.String classifier, java.lang.String extension, java.lang.String version, java.util.Map<java.lang.String,java.lang.String> properties)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getArtifactId()
          Gets the artifact identifier of this artifact, for example "maven-model".
 java.lang.String getBaseVersion()
          Gets the base version of this artifact, for example "1.0-SNAPSHOT".
 java.lang.String getClassifier()
          Gets the classifier of this artifact, for example "sources".
 java.lang.String getExtension()
          Gets the (file) extension of this artifact, for example "jar".
 java.io.File getFile()
          Gets the file of this artifact.
 java.lang.String getGroupId()
          Gets the group identifier of this artifact, for example "org.apache.maven".
 java.util.Map<java.lang.String,java.lang.String> getProperties()
          Gets the properties of this artifact.
 java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
          Gets the specified property.
 java.lang.String getVersion()
          Gets the version of this artifact, for example "1.0-20100529-1213".
 int hashCode()
           
protected  StubArtifact internalSetFile(java.io.File file)
           
 boolean isSnapshot()
          Determines whether this artifact uses a snapshot version.
 StubArtifact setFile(java.io.File file)
          Sets the file of the artifact.
 Artifact setProperties(java.util.Map<java.lang.String,java.lang.String> properties)
          Sets the properties for the artifact.
 Artifact setVersion(java.lang.String version)
          Sets the version of this artifact.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StubArtifact

public StubArtifact(java.lang.String coords,
                    java.util.Map<java.lang.String,java.lang.String> properties)

StubArtifact

public StubArtifact(java.lang.String coords)

StubArtifact

public StubArtifact(java.lang.String groupId,
                    java.lang.String artifactId,
                    java.lang.String classifier,
                    java.lang.String extension,
                    java.lang.String version,
                    java.util.Map<java.lang.String,java.lang.String> properties)

StubArtifact

public StubArtifact(java.lang.String groupId,
                    java.lang.String artifactId,
                    java.lang.String classifier,
                    java.lang.String extension,
                    java.lang.String version)
Method Detail

getGroupId

public java.lang.String getGroupId()
Description copied from interface: Artifact
Gets the group identifier of this artifact, for example "org.apache.maven".

Specified by:
getGroupId in interface Artifact
Returns:
The group identifier, never null.

getArtifactId

public java.lang.String getArtifactId()
Description copied from interface: Artifact
Gets the artifact identifier of this artifact, for example "maven-model".

Specified by:
getArtifactId in interface Artifact
Returns:
The artifact identifier, never null.

getVersion

public java.lang.String getVersion()
Description copied from interface: Artifact
Gets the version of this artifact, for example "1.0-20100529-1213". Note that in case of meta versions like "1.0-SNAPSHOT", the artifact's version depends on the state of the artifact. Artifacts that have been resolved or deployed will have the meta version expanded.

Specified by:
getVersion in interface Artifact
Returns:
The version, never null.

setVersion

public Artifact setVersion(java.lang.String version)
Description copied from interface: Artifact
Sets the version of this artifact.

Specified by:
setVersion in interface Artifact
Parameters:
version - The version of this artifact, may be null.
Returns:
The updated artifact, never null.

getBaseVersion

public java.lang.String getBaseVersion()
Description copied from interface: Artifact
Gets the base version of this artifact, for example "1.0-SNAPSHOT". In contrast to the Artifact.getVersion(), the base version will always refer to the unresolved meta version.

Specified by:
getBaseVersion in interface Artifact
Returns:
The base version, never null.

isSnapshot

public boolean isSnapshot()
Description copied from interface: Artifact
Determines whether this artifact uses a snapshot version.

Specified by:
isSnapshot in interface Artifact
Returns:
true if the artifact is a snapshot, false otherwise.

getClassifier

public java.lang.String getClassifier()
Description copied from interface: Artifact
Gets the classifier of this artifact, for example "sources".

Specified by:
getClassifier in interface Artifact
Returns:
The classifier or an empty string if none, never null.

getExtension

public java.lang.String getExtension()
Description copied from interface: Artifact
Gets the (file) extension of this artifact, for example "jar".

Specified by:
getExtension in interface Artifact
Returns:
The file extension, never null.

getFile

public java.io.File getFile()
Description copied from interface: Artifact
Gets the file of this artifact. Note that only resolved artifacts have a file associated with them.

Specified by:
getFile in interface Artifact
Returns:
The file or null if the artifact isn't resolved.

setFile

public StubArtifact setFile(java.io.File file)
Description copied from interface: Artifact
Sets the file of the artifact.

Specified by:
setFile in interface Artifact
Parameters:
file - The file of the artifact, may be null
Returns:
The updated artifact, never null.

internalSetFile

protected StubArtifact internalSetFile(java.io.File file)

getProperty

public java.lang.String getProperty(java.lang.String key,
                                    java.lang.String defaultValue)
Description copied from interface: Artifact
Gets the specified property.

Specified by:
getProperty in interface Artifact
Parameters:
key - The name of the property, must not be null.
defaultValue - The default value to return in case the property is not set, may be null.

getProperties

public java.util.Map<java.lang.String,java.lang.String> getProperties()
Description copied from interface: Artifact
Gets the properties of this artifact. While the exact set of available properties is undefined, the following properties are considered to be common:
type
A high-level characterization of the artifact, e.g. "maven-plugin" or "test-jar".
language
The programming language this artifact is relevant for, e.g. "java" or "none".
lacksDescriptor
A boolean flag indicating whether the artifact has knowingly no accompanying artifact descriptor.
includesDependencies
A boolean flag indicating whether the artifact presents some kind of bundle that physically includes its dependencies, e.g. a fat WAR.
constitutesBuildPath
A boolean flag indicating whether the artifact is meant to be used for the compile/runtime/test build path of a consumer project.

Specified by:
getProperties in interface Artifact
Returns:
The (read-only) properties, never null.

setProperties

public Artifact setProperties(java.util.Map<java.lang.String,java.lang.String> properties)
Description copied from interface: Artifact
Sets the properties for the artifact.

Specified by:
setProperties in interface Artifact
Parameters:
properties - The properties for the artifact, may be null.
Returns:
The updated artifact, never null.

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


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