org.sonatype.aether.util.artifact
Class AbstractArtifact

java.lang.Object
  extended by org.sonatype.aether.util.artifact.AbstractArtifact
All Implemented Interfaces:
Artifact
Direct Known Subclasses:
DefaultArtifact, DelegatingArtifact, SubArtifact

public abstract class AbstractArtifact
extends Object
implements Artifact

A skeleton class for artifacts that implements Object.equals(Object), Object.hashCode() and Object.toString().

Author:
Benjamin Bentmann

Constructor Summary
AbstractArtifact()
           
 
Method Summary
 boolean equals(Object obj)
           
 int hashCode()
           
protected static boolean isSnapshot(String version)
           
protected  Artifact newInstance(String groupId, String artifactId, String classifier, String extension, String version, Map<String,String> properties, File file)
          Creates a new artifact with the specified coordinates, properties and file.
 Artifact setFile(File file)
          Sets the file of the artifact.
 Artifact setProperties(Map<String,String> properties)
          Sets the properties for the artifact.
 Artifact setVersion(String version)
          Sets the version of this artifact.
protected static String toBaseVersion(String version)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.sonatype.aether.artifact.Artifact
getArtifactId, getBaseVersion, getClassifier, getExtension, getFile, getGroupId, getProperties, getProperty, getVersion, isSnapshot
 

Constructor Detail

AbstractArtifact

public AbstractArtifact()
Method Detail

isSnapshot

protected static boolean isSnapshot(String version)

toBaseVersion

protected static String toBaseVersion(String version)

newInstance

protected Artifact newInstance(String groupId,
                               String artifactId,
                               String classifier,
                               String extension,
                               String version,
                               Map<String,String> properties,
                               File file)
Creates a new artifact with the specified coordinates, properties and file.

Parameters:
groupId - The group identifier of the artifact, may be null.
artifactId - The artifact identifier of the artifact, may be null.
classifier - The classifier of the artifact, may be null.
extension - The file extension of the artifact, may be null.
version - The version of the artifact, may be null.
properties - The properties of the artifact, may be null if none. The method may assume immutability of the supplied map.
file - The resolved file of the artifact, may be null.

setVersion

public Artifact setVersion(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 or empty.
Returns:
The new artifact, never null.

setFile

public Artifact setFile(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 new artifact, never null.

setProperties

public Artifact setProperties(Map<String,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 new artifact, never null.

toString

public String toString()
Overrides:
toString in class Object

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2010-2013. All Rights Reserved.