Class PurlIdentifier

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Identifier>, Identifier

    public class PurlIdentifier
    extends java.lang.Object
    implements Identifier
    The Package-URL Identifier implementation.
    Author:
    Jeremy Long
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      PurlIdentifier​(com.github.packageurl.PackageURL purl, java.lang.String url, Confidence confidence)
      Constructs a new Package-URL identifier.
      PurlIdentifier​(com.github.packageurl.PackageURL purl, Confidence confidence)
      Constructs a new Package-URL identifier.
      PurlIdentifier​(java.lang.String type, java.lang.String namespace, java.lang.String name, java.lang.String version, Confidence confidence)
      Constructs a new Package-URL identifier.
      PurlIdentifier​(java.lang.String type, java.lang.String name, java.lang.String version, Confidence confidence)
      Constructs a new Package-URL identifier.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(@NotNull Identifier o)  
      boolean equals​(java.lang.Object obj)  
      Confidence getConfidence()
      Get the value of confidence.
      java.lang.String getName()
      Returns the Package URL name.
      java.lang.String getNamespace()
      Returns the Package URL name space.
      java.lang.String getNotes()
      Get the value of notes from suppression notes.
      java.lang.String getUrl()
      Get the value of URL.
      java.lang.String getValue()
      Get the string representation of the Identifier.
      java.lang.String getVersion()
      Returns the Package URL version.
      int hashCode()  
      void setConfidence​(Confidence confidence)
      Set the value of confidence.
      void setNotes​(java.lang.String notes)
      Set the value of notes.
      void setUrl​(java.lang.String url)
      Set the value of URL.
      java.lang.String toGav()
      Returns the GAV representation of the Package URL as utilized in gradle builds.
      java.lang.String toString()
      Returns the CPE 2.3 formatted string.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • 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,
                              java.lang.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​(java.lang.String type,
                              java.lang.String name,
                              java.lang.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​(java.lang.String type,
                              java.lang.String namespace,
                              java.lang.String name,
                              java.lang.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 Detail

      • getNotes

        public java.lang.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 java.lang.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​(java.lang.String url)
        Set the value of URL.
        Specified by:
        setUrl in interface Identifier
        Parameters:
        url - the value of URL
      • setNotes

        public void setNotes​(java.lang.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 java.lang.String toString()
        Returns the CPE 2.3 formatted string.
        Overrides:
        toString in class java.lang.Object
        Returns:
        the CPE 2.3 formatted string
      • getValue

        public java.lang.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 java.lang.String getNamespace()
        Returns the Package URL name space.
        Returns:
        the Package URL name space
      • getName

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

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

        public java.lang.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​(@NotNull
                             @NotNull Identifier o)
        Specified by:
        compareTo in interface java.lang.Comparable<Identifier>
      • hashCode

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object