Class 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>].
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ArtifactIdUtils

        private ArtifactIdUtils()
    • 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 be null.
        Returns:
        The artifact identifier or null if the input was null.
      • 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 be null.
        artifactId - The artifact id, may be null.
        extension - The file extensiion, may be null.
        classifier - The classifier, may be null.
        version - The version, may be null.
        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 be null.
        Returns:
        The artifact identifier or null if the input was null.
      • 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 be null.
        Returns:
        The artifact identifier or null if the input was null.
      • 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 be null.
        artifactId - The artifact id, may be null.
        extension - The file extensiion, may be null.
        classifier - The classifier, may be null.
        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 calling String.equals(Object) on the return values from toId(Artifact) for the artifacts but does not incur the overhead of creating temporary strings.
        Parameters:
        artifact1 - The first artifact, may be null.
        artifact2 - The second artifact, may be null.
        Returns:
        true if both artifacts are not null 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 calling String.equals(Object) on the return values from toBaseId(Artifact) for the artifacts but does not incur the overhead of creating temporary strings.
        Parameters:
        artifact1 - The first artifact, may be null.
        artifact2 - The second artifact, may be null.
        Returns:
        true if both artifacts are not null 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 calling String.equals(Object) on the return values from toVersionlessId(Artifact) for the artifacts but does not incur the overhead of creating temporary strings.
        Parameters:
        artifact1 - The first artifact, may be null.
        artifact2 - The second artifact, may be null.
        Returns:
        true if both artifacts are not null and have equal versionless ids, false otherwise.