org.apache.sling.provisioning.model

## Class Artifact

- java.lang.Object
- - org.apache.sling.provisioning.model.Traceable
  - - org.apache.sling.provisioning.model.Commentable
    - - org.apache.sling.provisioning.model.Artifact

All Implemented Interfaces:
  Comparable

    public class Artifact
    extends Commentable
    implements Comparable

Description of an artifact. An artifact is described by it's Apache Maven coordinates consisting of group id, artifact id, and version. In addition, the classifier and type can be specified as well. If no type is specified, "jar" is assumed. An artifact can have any metadata.

### Constructor Summary

Constructors
Constructor and Description
`Artifact(String gId, String aId, String version, String classifier, String type)` Create a new artifact object
`Artifact(String gId, String aId, String version, String classifier, String type, Map<String,String> metadata)` Create a new artifact object

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`int` `compareTo(Object o)`
`boolean` `equals(Object o)`
`static Artifact` `fromMvnUrl(String url)` Create a new artifact from a maven url, 'mvn:' [ repository-url '!' ] group-id '/' artifact-id [ '/' [version] [ '/' [type] [ '/' classifier ] ] ] ]
`String` `getArtifactId()` Return the artifact id.
`String` `getClassifier()` Return the optional classifier.
`String` `getGroupId()` Return the group id.
`Map<String,String>` `getMetadata()` Get the metadata of the artifact.
`String` `getRepositoryPath()` Create a Maven like relative repository path.
`String` `getType()` Return the type.
`String` `getVersion()` Return the version.
`int` `hashCode()`
`String` `toMvnUrl()` Return a mvn url
`String` `toString()`

### Methods inherited from class org.apache.sling.provisioning.model.Commentable

`getComment, setComment`

### Methods inherited from class org.apache.sling.provisioning.model.Traceable

`getLocation, setLocation`

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

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

### Constructor Detail

#### Artifact

    public Artifact(String gId,
                    String aId,
                    String version,
                    String classifier,
                    String type)

Create a new artifact object

Parameters:
  `gId` - The group id (required)
  `aId` - The artifact id (required)
  `version` - The version (required)
  `classifier` - The classifier (optional)
  `type` - The type/extension (optional, defaults to jar)

#### Artifact

    public Artifact(String gId,
                    String aId,
                    String version,
                    String classifier,
                    String type,
                    Map<String,String> metadata)

Create a new artifact object

Parameters:
  `gId` - The group id (required)
  `aId` - The artifact id (required)
  `version` - The version (required)
  `classifier` - The classifier (optional)
  `type` - The type/extension (optional, defaults to jar)
  `metadata` - The metadata associated with the Artifact

### Method Detail

#### fromMvnUrl

    public static Artifact fromMvnUrl(String url)

Create a new artifact from a maven url, 'mvn:' [ repository-url '!' ] group-id '/' artifact-id [ '/' [version] [ '/' [type] [ '/' classifier ] ] ] ]

Parameters:
  `url` - The url
Returns:
  A new artifact
Throws:
  `IllegalArgumentException` - If the url is not valid

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### equals

    public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

#### compareTo

    public int compareTo(Object o)

Specified by:
  `compareTo` in interface `Comparable`

#### toMvnUrl

    public String toMvnUrl()

Return a mvn url

Returns:
  A mvn url
See Also:
  `fromMvnUrl(String)`

#### getGroupId

    public String getGroupId()

Return the group id.

Returns:
  The group id.

#### getArtifactId

    public String getArtifactId()

Return the artifact id.

Returns:
  The artifact id.

#### getVersion

    public String getVersion()

Return the version.

Returns:
  The version.

#### getClassifier

    public String getClassifier()

Return the optional classifier.

Returns:
  The classifier or null.

#### getType

    public String getType()

Return the type.

Returns:
  The type.

#### getMetadata

    public Map<String,String> getMetadata()

Get the metadata of the artifact.

Returns:
  The metadata.

#### getRepositoryPath

    public String getRepositoryPath()

Create a Maven like relative repository path.

Returns:
  A relative repository path.

#### toString

    public String toString()

Overrides:
  `toString` in class `Commentable`