Class BugPattern

  • All Implemented Interfaces:
    java.lang.Comparable<BugPattern>

    public class BugPattern
    extends java.lang.Object
    implements java.lang.Comparable<BugPattern>
    A BugPattern object collects all of the metadata for a particular species of BugInstance. Specifically, it stores the human-readable text for displaying a bug instance. BugPatterns derive from the BugPattern elements in the "findbugs.xml" and "messages.xml" found in a FindBugs plugin.
    Author:
    David Hovemeyer
    See Also:
    BugInstance
    • Constructor Detail

      • BugPattern

        public BugPattern​(java.lang.String type,
                          java.lang.String abbrev,
                          java.lang.String category,
                          boolean experimental,
                          java.lang.String shortDescription,
                          java.lang.String longDescription,
                          java.lang.String detailText,
                          java.lang.String bugsUrl,
                          int cweid)
        Constructor.
        Parameters:
        type - the type (species) of BugInstance
        abbrev - the abbreviation or "bug code"; see BugCode
        category - the category
        experimental - true if the bug pattern is experimental
        shortDescription - short one-line description of the bug species
        longDescription - longer one-line description; may contain placeholders for use by FindBugsMessageFormat to format BugAnnotations
        detailText - HTML text containing a full description of the bug species
        bugsUrl - URL of web-page containing bug descriptions or null if there's no such page.
    • Method Detail

      • getType

        public java.lang.String getType()
        Get the BugPattern
      • getAbbrev

        public java.lang.String getAbbrev()
        Get the BugKind
      • getBugCode

        @Nonnull
        public BugCode getBugCode()
        Get the BugCode
      • getCategory

        public java.lang.String getCategory()
        Get the BugCategory
      • getPriorityAdjustment

        public int getPriorityAdjustment()
      • adjustPriority

        public void adjustPriority​(int change)
      • getCategoryAbbrev

        public java.lang.String getCategoryAbbrev()
      • isExperimental

        public boolean isExperimental()
        Is the bug pattern experimental?
      • getShortDescription

        public java.lang.String getShortDescription()
        Get the short description.
      • getLongDescription

        public java.lang.String getLongDescription()
        Get the long description.
      • getDetailText

        public java.lang.String getDetailText()
        Get the HTML detail text describing the bug.
      • getDetailPlainText

        public java.lang.String getDetailPlainText()
        Get the Plain text describing the bug.
      • getDetailHTML

        public java.lang.String getDetailHTML()
        Get the detail text as a complete HTML document.
      • getDetailHTML

        public java.lang.String getDetailHTML​(java.lang.String detailText)
      • wrapInDescriptionLink

        public java.lang.String wrapInDescriptionLink​(java.lang.String text)
      • getUri

        public java.util.Optional<java.net.URI> getUri()
      • compareTo

        public int compareTo​(BugPattern other)
        Specified by:
        compareTo in interface java.lang.Comparable<BugPattern>
      • hashCode

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

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • getCWEid

        public int getCWEid()
        Returns:
        Returns the cweid.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • isDeprecated

        public boolean isDeprecated()
        Returns:
        true if this bug pattern is not used anymore and exists for backward compatibility only