Class PurlIdentifier

java.lang.Object
org.owasp.dependencycheck.dependency.naming.PurlIdentifier
All Implemented Interfaces:
Serializable, Comparable<Identifier>, Identifier

public class PurlIdentifier extends Object implements Identifier
The Package-URL Identifier implementation.
Author:
Jeremy Long
See Also:
  • Constructor Details

    • PurlIdentifier

      public PurlIdentifier(com.github.packageurl.PackageURL purl, Confidence confidence)
      Constructs a new Package-URL identifier.
      Parameters:
      purl - the Package-URL object
      confidence - the confidence that the identifier is correct for the given dependency
    • PurlIdentifier

      public PurlIdentifier(com.github.packageurl.PackageURL purl, String url, Confidence confidence)
      Constructs a new Package-URL identifier.
      Parameters:
      purl - the Package-URL object
      url - the URL for the identifier
      confidence - the confidence that the identifier is correct for the given dependency
    • PurlIdentifier

      public PurlIdentifier(String type, String name, String version, Confidence confidence) throws com.github.packageurl.MalformedPackageURLException
      Constructs a new Package-URL identifier.
      Parameters:
      type - the type of package-URL
      name - the name
      version - the version
      confidence - the confidence that the identifier is correct for the given dependency
      Throws:
      com.github.packageurl.MalformedPackageURLException - thrown if the type, name space, name, and version cannot be converted into a package-URL
    • PurlIdentifier

      public PurlIdentifier(String type, String namespace, String name, String version, Confidence confidence) throws com.github.packageurl.MalformedPackageURLException
      Constructs a new Package-URL identifier.
      Parameters:
      type - the type of package-URL
      namespace - the name space
      name - the name
      version - the version
      confidence - the confidence that the identifier is correct for the given dependency
      Throws:
      com.github.packageurl.MalformedPackageURLException - thrown if the type, name space, name, and version cannot be converted into a package-URL
  • Method Details

    • getConfidence

      public Confidence getConfidence()
      Description copied from interface: Identifier
      Get the value of confidence.
      Specified by:
      getConfidence in interface Identifier
      Returns:
      the value of confidence
    • getNotes

      public String getNotes()
      Description copied from interface: Identifier
      Get the value of notes from suppression notes.
      Specified by:
      getNotes in interface Identifier
      Returns:
      the value of notes
    • getUrl

      public String getUrl()
      Description copied from interface: Identifier
      Get the value of URL.
      Specified by:
      getUrl in interface Identifier
      Returns:
      the value of URL
    • setConfidence

      public void setConfidence(Confidence confidence)
      Set the value of confidence.
      Specified by:
      setConfidence in interface Identifier
      Parameters:
      confidence - the value of confidence
    • setUrl

      public void setUrl(String url)
      Set the value of URL.
      Specified by:
      setUrl in interface Identifier
      Parameters:
      url - the value of URL
    • setNotes

      public void setNotes(String notes)
      Description copied from interface: Identifier
      Set the value of notes.
      Specified by:
      setNotes in interface Identifier
      Parameters:
      notes - new value of notes
    • toString

      public String toString()
      Returns the CPE 2.3 formatted string.
      Overrides:
      toString in class Object
      Returns:
      the CPE 2.3 formatted string
    • getValue

      public String getValue()
      Description copied from interface: Identifier
      Get the string representation of the Identifier.
      Specified by:
      getValue in interface Identifier
      Returns:
      the value of notes
    • getNamespace

      public String getNamespace()
      Returns the Package URL name space.
      Returns:
      the Package URL name space
    • getName

      public String getName()
      Returns the Package URL name.
      Returns:
      the Package URL name.
      See Also:
      • PackageURL.getName()
    • getVersion

      public String getVersion()
      Returns the Package URL version.
      Returns:
      the Package URL name.
      See Also:
      • PackageURL.getVersion()
    • toGav

      public String toGav()
      Returns the GAV representation of the Package URL as utilized in gradle builds.
      Returns:
      the GAV representation of the Package URL
    • compareTo

      public int compareTo(@NonNull Identifier o)
      Specified by:
      compareTo in interface Comparable<Identifier>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object