Package org.eclipse.aether.util.artifact
Class ArtifactIdUtils
- java.lang.Object
-
- org.eclipse.aether.util.artifact.ArtifactIdUtils
-
public final class ArtifactIdUtils extends java.lang.Object
A utility class for artifact identifiers.
-
-
Field Summary
Fields Modifier and Type Field Description private static char
SEP
-
Constructor Summary
Constructors Modifier Constructor Description private
ArtifactIdUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.lang.StringBuilder
concat(java.lang.String groupId, java.lang.String artifactId, java.lang.String extension, java.lang.String classifier)
static boolean
equalsBaseId(Artifact artifact1, Artifact artifact2)
Determines whether two artifacts have the same base identifier.static boolean
equalsId(Artifact artifact1, Artifact artifact2)
Determines whether two artifacts have the same identifier.static boolean
equalsVersionlessId(Artifact artifact1, Artifact artifact2)
Determines whether two artifacts have the same versionless identifier.static java.lang.String
toBaseId(Artifact artifact)
Creates an artifact identifier of the form<groupId>:<artifactId>:<extension>[:<classifier>]:<baseVersion>
.static java.lang.String
toId(java.lang.String groupId, java.lang.String artifactId, java.lang.String extension, java.lang.String classifier, java.lang.String version)
Creates an artifact identifier of the form<groupId>:<artifactId>:<extension>[:<classifier>]:<version>
.static java.lang.String
toId(Artifact artifact)
Creates an artifact identifier of the form<groupId>:<artifactId>:<extension>[:<classifier>]:<version>
.static java.lang.String
toVersionlessId(java.lang.String groupId, java.lang.String artifactId, java.lang.String extension, java.lang.String classifier)
Creates an artifact identifier of the form<groupId>:<artifactId>:<extension>[:<classifier>]
.static java.lang.String
toVersionlessId(Artifact artifact)
Creates an artifact identifier of the form<groupId>:<artifactId>:<extension>[:<classifier>]
.
-
-
-
Field Detail
-
SEP
private static final char SEP
- See Also:
- Constant Field Values
-
-
Method Detail
-
toId
public static java.lang.String toId(Artifact artifact)
Creates an artifact identifier of the form<groupId>:<artifactId>:<extension>[:<classifier>]:<version>
.- Parameters:
artifact
- The artifact to create an identifer for, may benull
.- Returns:
- The artifact identifier or
null
if the input wasnull
.
-
toId
public static java.lang.String toId(java.lang.String groupId, java.lang.String artifactId, java.lang.String extension, java.lang.String classifier, java.lang.String version)
Creates an artifact identifier of the form<groupId>:<artifactId>:<extension>[:<classifier>]:<version>
.- Parameters:
groupId
- The group id, may benull
.artifactId
- The artifact id, may benull
.extension
- The file extensiion, may benull
.classifier
- The classifier, may benull
.version
- The version, may benull
.- Returns:
- The artifact identifier, never
null
.
-
toBaseId
public static java.lang.String toBaseId(Artifact artifact)
Creates an artifact identifier of the form<groupId>:<artifactId>:<extension>[:<classifier>]:<baseVersion>
.- Parameters:
artifact
- The artifact to create an identifer for, may benull
.- Returns:
- The artifact identifier or
null
if the input wasnull
.
-
toVersionlessId
public static java.lang.String toVersionlessId(Artifact artifact)
Creates an artifact identifier of the form<groupId>:<artifactId>:<extension>[:<classifier>]
.- Parameters:
artifact
- The artifact to create an identifer for, may benull
.- Returns:
- The artifact identifier or
null
if the input wasnull
.
-
toVersionlessId
public static java.lang.String toVersionlessId(java.lang.String groupId, java.lang.String artifactId, java.lang.String extension, java.lang.String classifier)
Creates an artifact identifier of the form<groupId>:<artifactId>:<extension>[:<classifier>]
.- Parameters:
groupId
- The group id, may benull
.artifactId
- The artifact id, may benull
.extension
- The file extensiion, may benull
.classifier
- The classifier, may benull
.- Returns:
- The artifact identifier, never
null
.
-
concat
private static java.lang.StringBuilder concat(java.lang.String groupId, java.lang.String artifactId, java.lang.String extension, java.lang.String classifier)
-
equalsId
public static boolean equalsId(Artifact artifact1, Artifact artifact2)
Determines whether two artifacts have the same identifier. This method is equivalent to callingString.equals(Object)
on the return values fromtoId(Artifact)
for the artifacts but does not incur the overhead of creating temporary strings.- Parameters:
artifact1
- The first artifact, may benull
.artifact2
- The second artifact, may benull
.- Returns:
true
if both artifacts are notnull
and have equal ids,false
otherwise.
-
equalsBaseId
public static boolean equalsBaseId(Artifact artifact1, Artifact artifact2)
Determines whether two artifacts have the same base identifier. This method is equivalent to callingString.equals(Object)
on the return values fromtoBaseId(Artifact)
for the artifacts but does not incur the overhead of creating temporary strings.- Parameters:
artifact1
- The first artifact, may benull
.artifact2
- The second artifact, may benull
.- Returns:
true
if both artifacts are notnull
and have equal base ids,false
otherwise.
-
equalsVersionlessId
public static boolean equalsVersionlessId(Artifact artifact1, Artifact artifact2)
Determines whether two artifacts have the same versionless identifier. This method is equivalent to callingString.equals(Object)
on the return values fromtoVersionlessId(Artifact)
for the artifacts but does not incur the overhead of creating temporary strings.- Parameters:
artifact1
- The first artifact, may benull
.artifact2
- The second artifact, may benull
.- Returns:
true
if both artifacts are notnull
and have equal versionless ids,false
otherwise.
-
-