public class ArtifactId extends Object implements Comparable<ArtifactId>
jar is assumed.
This class is not thread-safe.| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_TYPE
The default type if
null is provided as a type. |
| Constructor and Description |
|---|
ArtifactId(String groupId,
String artifactId,
String version,
String classifier,
String type)
Create a new artifact object
|
| Modifier and Type | Method and Description |
|---|---|
ArtifactId |
changeClassifier(String newClassifier)
Provide artifact id with a different classifier.
|
ArtifactId |
changeType(String newType)
Provide artifact id with a different type.
|
ArtifactId |
changeVersion(String newVersion)
Provide artifact id with a different version.
|
int |
compareTo(ArtifactId o) |
boolean |
equals(Object o) |
static ArtifactId |
fromMvnId(String coordinates)
Create a new artifact id from maven coordinates/id
groupId:artifactId[:packaging[:classifier]]:version
|
static ArtifactId |
fromMvnPath(String path)
Create a new artifact id from a maven path The schema is
groupIdPath/artifactId/version/artifactId-version[-classifier].type |
static ArtifactId |
fromMvnUrl(String url)
Create a new artifact id from a maven url,
'mvn:' 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.
|
org.osgi.framework.Version |
getOSGiVersion()
Return the OSGi version
|
String |
getType()
Return the type.
|
String |
getVersion()
Return the version.
|
int |
hashCode() |
boolean |
isSame(ArtifactId id)
Test whether the artifact id is pointing to the same artifact but potentially a different version
|
static ArtifactId |
parse(String s)
Create a new artifact id from a string, the string must either be a
mvn url or a mvn id (= coordinates)
|
String |
toMvnId()
Return a mvn id
|
String |
toMvnName()
Create a Maven like repository name
|
String |
toMvnPath()
Create a Maven like relative repository path.
|
String |
toMvnUrl()
Return a mvn url
|
String |
toString() |
public static final String DEFAULT_TYPE
null is provided as a type. @since 1.3public ArtifactId(String groupId, String artifactId, String version, String classifier, String type)
groupId - The group id (required)artifactId - The artifact id (required)version - The version (required)classifier - The classifier (optional)type - The type/extension (optional, defaults to
#DEFAULT_TYPE.IllegalArgumentException - If group id, artifact id or version are
null.public static ArtifactId parse(String s)
s - The string to parseIllegalArgumentException - if the string can't be parsed to a valid artifact id.public static ArtifactId fromMvnUrl(String url)
url - The urlIllegalArgumentException - If the url is not validpublic static ArtifactId fromMvnId(String coordinates)
coordinates - The coordinates as outlined aboveIllegalArgumentException - If the id is not validpublic static ArtifactId fromMvnPath(String path)
groupIdPath/artifactId/version/artifactId-version[-classifier].typepath - The maven pathIllegalArgumentException - If the path is not validpublic String toMvnUrl()
fromMvnUrl(String)public String toMvnId()
fromMvnId(String)public String getGroupId()
public String getArtifactId()
public String getClassifier()
null.public String getType()
public String getVersion()
public boolean isSame(ArtifactId id)
id - The artifact idtrue if group id, artifact id, type and classifier equalpublic org.osgi.framework.Version getOSGiVersion()
IllegalArgumentException - If the numerical components are negative or
the qualifier string is invalid.public String toMvnPath()
public String toMvnName()
public ArtifactId changeVersion(String newVersion)
newVersion - The new versionIllegalArgumentException - if the version is nullpublic ArtifactId changeType(String newType)
newType - The new type, if null the default
#DEFAULT_TYPE is usedpublic ArtifactId changeClassifier(String newClassifier)
newClassifier - The new classifierpublic int compareTo(ArtifactId o)
compareTo in interface Comparable<ArtifactId>Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.