Class Purl

java.lang.Object
io.quarkus.sbom.Purl

public final class Purl extends Object
A lightweight, immutable Package URL (PURL) representation following the purl-spec.

Format: pkg:<type>/<namespace>/<name>@<version>?<qualifiers>#<subpath>

  • Field Details

  • Method Details

    • maven

      public static Purl maven(String groupId, String artifactId, String version)
      Creates a Maven PURL with type=jar qualifier.
      Parameters:
      groupId - Maven groupId (used as namespace)
      artifactId - Maven artifactId (used as name)
      version - artifact version
      Returns:
      a Maven PURL
    • maven

      public static Purl maven(String groupId, String artifactId, String version, String artifactType, String classifier)
      Creates a Maven PURL with explicit type and classifier qualifiers.
      Parameters:
      groupId - Maven groupId (used as namespace)
      artifactId - Maven artifactId (used as name)
      version - artifact version
      artifactType - Maven artifact type (e.g., "jar", "war")
      classifier - Maven classifier, or null
      Returns:
      a Maven PURL
    • npm

      public static Purl npm(String namespace, String name, String version)
      Creates an npm PURL.
      Parameters:
      namespace - the npm scope (e.g., "@babel"), or null for unscoped packages
      name - the package name
      version - the package version
      Returns:
      an npm PURL
    • generic

      public static Purl generic(String name, String version)
      Creates a generic PURL with no namespace or qualifiers.
      Parameters:
      name - the component name
      version - the component version
      Returns:
      a generic PURL
    • of

      public static Purl of(String type, String namespace, String name, String version)
      Creates a PURL with the specified type.
      Parameters:
      type - the package ecosystem type
      namespace - the namespace, or null
      name - the package name
      version - the version, or null
      Returns:
      a PURL
    • builder

      public static Purl.Builder builder()
    • parse

      public static Purl parse(String purlString)
      Parses a canonical PURL string.
      Parameters:
      purlString - a PURL string starting with "pkg:"
      Returns:
      the parsed Purl
      Throws:
      IllegalArgumentException - if the string is not a valid PURL
    • getType

      public String getType()
    • getNamespace

      public String getNamespace()
    • getName

      public String getName()
    • getVersion

      public String getVersion()
    • getQualifiers

      public Map<String,String> getQualifiers()
    • getSubpath

      public String getSubpath()
    • toString

      public String toString()
      Returns the canonical PURL string representation.
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object