Class DetectorFactoryCollection

java.lang.Object
edu.umd.cs.findbugs.DetectorFactoryCollection

public class DetectorFactoryCollection extends Object
The DetectorFactoryCollection stores all of the DetectorFactory objects used to create the Detectors which implement the various analyses. It is a singleton class.
Author:
David Hovemeyer
See Also:
  • Field Details

  • Constructor Details

    • DetectorFactoryCollection

      public DetectorFactoryCollection()
    • DetectorFactoryCollection

      public DetectorFactoryCollection(Plugin onlyPlugin)
    • DetectorFactoryCollection

      protected DetectorFactoryCollection(Collection<Plugin> enabled)
  • Method Details

    • resetInstance

      public static void resetInstance(@CheckForNull DetectorFactoryCollection instance)
      Reset the factory singleton.

      Implementation note: This method is public for tests only!

      Parameters:
      instance - use null to clear the instance
    • instance

      public static DetectorFactoryCollection instance()
      Get the single instance of DetectorFactoryCollection, which knows each and every loaded plugin, independently of it's enablement
    • pluginIterator

      public Iterator<Plugin> pluginIterator()
      Return an Iterator over all available Plugin objects.
    • plugins

      public Collection<Plugin> plugins()
      Return an Collection of all available Plugin objects.
    • getCorePlugin

      @Nonnull public Plugin getCorePlugin()
    • getPluginById

      public Plugin getPluginById(String pluginId)
      Get a Plugin by its unique id.
      Parameters:
      pluginId - the unique id
      Returns:
      the Plugin with that id, or null if no such Plugin is found
    • factoryIterator

      public Iterator<DetectorFactory> factoryIterator()
      Return an Iterator over the DetectorFactory objects for all registered Detectors.
    • getFactories

      public Iterable<DetectorFactory> getFactories()
      Return an Iterable over the DetectorFactory objects for all registered Detectors.
    • isDisabledByDefault

      public boolean isDisabledByDefault(String bugPatternOrCode)
    • getFactory

      public DetectorFactory getFactory(String name)
      Look up a DetectorFactory by its short name.
      Parameters:
      name - the short name
      Returns:
      the DetectorFactory, or null if there is no factory with that short name
    • getFactoryByClassName

      public DetectorFactory getFactoryByClassName(String className)
      Look up a DetectorFactory by its class name.
      Parameters:
      className - the class name
      Returns:
      the DetectoryFactory, or null if there is no factory with that class name
    • getFindBugsHome

      public static String getFindBugsHome()
    • getCoreResource

      @CheckForNull public static URL getCoreResource(String name)
    • jawsDebugMessage

      public static void jawsDebugMessage(String message)
    • registerBugCategory

      public boolean registerBugCategory(BugCategory bc)
      Set the metadata for a bug category. If the category's metadata has already been set, this does nothing.
      Parameters:
      bc - the BugCategory object holding the metadata for the category
      Returns:
      false if the category's metadata has already been set, true otherwise
    • unRegisterBugCategory

      protected boolean unRegisterBugCategory(BugCategory bc)
    • registerBugPattern

      public void registerBugPattern(BugPattern bugPattern)
      Register a BugPattern.
      Parameters:
      bugPattern - the BugPattern
    • unRegisterBugPattern

      protected void unRegisterBugPattern(BugPattern bugPattern)
    • bugPatternIterator

      public Iterator<BugPattern> bugPatternIterator()
      Get an Iterator over all registered bug patterns.
    • getBugPatterns

      public Collection<BugPattern> getBugPatterns()
      Get an Iterator over all registered bug patterns.
    • lookupBugPattern

      @CheckForNull public BugPattern lookupBugPattern(String bugType)
      Look up bug pattern.
      Parameters:
      bugType - the bug type for the bug pattern
      Returns:
      the BugPattern, or null if it can't be found
    • registerBugCode

      public void registerBugCode(BugCode bugCode)
    • unRegisterBugCode

      protected void unRegisterBugCode(BugCode bugCode)
    • getBugCodes

      public Collection<BugCode> getBugCodes()
    • getBugCode

      @Nonnull public BugCode getBugCode(String shortBugType)
      Get a description for given "bug type". FIXME: this is referred to elsewhere as the "bug code" or "bug abbrev". Should make the terminology consistent everywhere. In this case, the bug type refers to the short prefix code prepended to the long and short bug messages.
      Parameters:
      shortBugType - the short bug type code
      Returns:
      the description of that short bug type code means
    • lookupBugCode

      @CheckForNull public BugCode lookupBugCode(String shortBugType)
      Parameters:
      shortBugType - the short bug type code
      Returns:
      the description of that short bug type code means
    • getBugCategory

      public BugCategory getBugCategory(String category)
      Get the BugCategory object for a category key. Returns null if no BugCategory object can be found.
      Parameters:
      category - the category key
      Returns:
      the BugCategory object (may be null)
    • getBugCategories

      public Collection<String> getBugCategories()
      Get a Collection containing all known bug category keys. E.g., "CORRECTNESS", "MT_CORRECTNESS", "PERFORMANCE", etc. Excludes hidden bug categories
      Returns:
      Collection of bug category keys.
    • getBugCategoryObjects

      public Collection<BugCategory> getBugCategoryObjects()