edu.umd.cs.findbugs

Class DetectorFactory

public class DetectorFactory extends Object

A DetectorFactory is responsible for creating instances of Detector objects and for maintaining meta-information about the detector class.

Author: David Hovemeyer

See Also: Detector

Constructor Summary
DetectorFactory(Plugin plugin, Class<?> detectorClass, boolean enabled, String speed, String reports, String requireJRE)
Constructor.
Method Summary
Detectorcreate(BugReporter bugReporter)
Create a Detector instance.
Detector2createDetector2(BugReporter bugReporter)
Create a Detector2 instance.
StringgetDetailHTML()
Get an HTML document describing the Detector.
StringgetFullName()
Get the full name of the detector.
PlugingetPlugin()
Get the Plugin that this Detector is part of.
intgetPositionSpecifiedInPluginDescriptor()
Get the overall position in which this detector was specified in the plugin descriptor.
intgetPriorityAdjustment()
Get the priority adjustment for the detector produced by this factory.
StringgetReportedBugPatternCodes()
Get list of bug pattern codes reported by the detector: blank if unknown.
Collection<BugPattern>getReportedBugPatterns()
Get Collection of all BugPatterns this detector reports.
StringgetShortName()
Get the short name of the Detector.
StringgetSpeed()
Get the speed of the Detector produced by this factory.
booleanisDefaultEnabled()
Is this factory enabled by default
booleanisDetectorClassSubtypeOf(Class<?> otherClass)
Determine whether the detector class is a subtype of the given class (or interface).
booleanisEnabledForCurrentJRE()
Check to see if we are running on a recent-enough JRE for this detector to be enabled.
booleanisHidden()
Get visibility of the factory (to GUI dialogs to configure detectors).
booleanisReportingDetector()
Return whether or not this DetectorFactory produces detectors which report warnings.
voidsetDetailHTML(String detailHTML)
Set the HTML document describing the Detector.
voidsetEnabledButNonReporting(boolean notReporting)
voidsetHidden(boolean hidden)
Set visibility of the factory (to GUI dialogs to configure detectors).
voidsetPositionSpecifiedInPluginDescriptor(int positionSpecifiedInPluginDescriptor)
Set the overall position in which this detector was specified in the plugin descriptor.
voidsetPriorityAdjustment(int priorityAdjustment)
Set the priority adjustment for the detector produced by this factory.

Constructor Detail

DetectorFactory

public DetectorFactory(Plugin plugin, Class<?> detectorClass, boolean enabled, String speed, String reports, String requireJRE)
Constructor.

Parameters: plugin the Plugin the Detector is part of detectorClass the Class object of the Detector enabled true if the Detector is enabled by default, false if disabled speed a string describing roughly how expensive the analysis performed by the detector is; suggested values are "fast", "moderate", and "slow" reports comma separated list of bug pattern codes reported by the detector; empty if unknown requireJRE string describing JRE version required to run the the detector: e.g., "1.5"

Method Detail

create

public Detector create(BugReporter bugReporter)

Deprecated: Use createDetector2 in new code

Create a Detector instance. This method is only guaranteed to work for old-style detectors using the BCEL bytecode framework.

Parameters: bugReporter the BugReporter to be used to report bugs

Returns: the Detector

createDetector2

public Detector2 createDetector2(BugReporter bugReporter)
Create a Detector2 instance.

Parameters: bugReporter the BugReporter to be used to report bugs

Returns: the Detector2

getDetailHTML

public String getDetailHTML()
Get an HTML document describing the Detector.

getFullName

public String getFullName()
Get the full name of the detector. This is the name of the detector class, with package qualification.

getPlugin

public Plugin getPlugin()
Get the Plugin that this Detector is part of.

Returns: the Plugin this Detector is part of

getPositionSpecifiedInPluginDescriptor

public int getPositionSpecifiedInPluginDescriptor()
Get the overall position in which this detector was specified in the plugin descriptor.

Returns: position in plugin descriptor

getPriorityAdjustment

public int getPriorityAdjustment()
Get the priority adjustment for the detector produced by this factory.

Returns: the priority adjustment

getReportedBugPatternCodes

public String getReportedBugPatternCodes()
Get list of bug pattern codes reported by the detector: blank if unknown.

getReportedBugPatterns

public Collection<BugPattern> getReportedBugPatterns()
Get Collection of all BugPatterns this detector reports. An empty Collection means that we don't know what kind of bug patterns might be reported.

getShortName

public String getShortName()
Get the short name of the Detector. This is the name of the detector class without the package qualification.

getSpeed

public String getSpeed()
Get the speed of the Detector produced by this factory.

isDefaultEnabled

public boolean isDefaultEnabled()
Is this factory enabled by default

isDetectorClassSubtypeOf

public boolean isDetectorClassSubtypeOf(Class<?> otherClass)
Determine whether the detector class is a subtype of the given class (or interface).

Parameters: otherClass a class or interface

Returns: true if the detector class is a subtype of the given class or interface

isEnabledForCurrentJRE

public boolean isEnabledForCurrentJRE()
Check to see if we are running on a recent-enough JRE for this detector to be enabled.

Returns: true if the current JRE is recent enough to run the Detector, false if it is too old

isHidden

public boolean isHidden()
Get visibility of the factory (to GUI dialogs to configure detectors).

isReportingDetector

public boolean isReportingDetector()
Return whether or not this DetectorFactory produces detectors which report warnings.

Returns: true if the created Detectors report warnings, false if not

setDetailHTML

public void setDetailHTML(String detailHTML)
Set the HTML document describing the Detector.

setEnabledButNonReporting

public void setEnabledButNonReporting(boolean notReporting)

setHidden

public void setHidden(boolean hidden)
Set visibility of the factory (to GUI dialogs to configure detectors). Invisible detectors are those that are needed behind the scenes, but shouldn't be explicitly enabled or disabled by the user.

Parameters: hidden true if this factory should be hidden, false if not

setPositionSpecifiedInPluginDescriptor

public void setPositionSpecifiedInPluginDescriptor(int positionSpecifiedInPluginDescriptor)
Set the overall position in which this detector was specified in the plugin descriptor.

Parameters: positionSpecifiedInPluginDescriptor position in plugin descriptor

setPriorityAdjustment

public void setPriorityAdjustment(int priorityAdjustment)
Set the priority adjustment for the detector produced by this factory.

Parameters: priorityAdjustment the priority adjustment

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.