edu.umd.cs.findbugs
Class DetectorFactory

java.lang.Object
  extended by edu.umd.cs.findbugs.DetectorFactory

public class DetectorFactory
extends java.lang.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

Field Summary
private static java.lang.Class[] constructorArgTypes
           
private  boolean defEnabled
           
private  java.lang.String detailHTML
           
private  java.lang.Class detectorClass
           
private  boolean enabled
           
private  boolean firstInPass
           
private  boolean hidden
           
private  Plugin plugin
           
private  int priorityAdjustment
           
private  java.lang.String reports
           
private  java.lang.String requireJRE
           
private  java.lang.String speed
           
 
Constructor Summary
DetectorFactory(Plugin plugin, java.lang.Class detectorClass, boolean enabled, java.lang.String speed, java.lang.String reports, java.lang.String requireJRE)
          Constructor.
 
Method Summary
 Detector create(BugReporter bugReporter)
          Create a Detector instance.
 java.lang.String getDetailHTML()
          Get an HTML document describing the Detector.
 java.lang.String getFullName()
          Get the full name of the detector.
 Plugin getPlugin()
          Get the Plugin that this Detector is part of.
 int getPriorityAdjustment()
          Get the priority adjustment for the detector produced by this factory.
 java.lang.String getReportedBugPatternCodes()
          Get list of bug pattern codes reported by the detector: blank if unknown.
 java.util.Collection<BugPattern> getReportedBugPatterns()
          Get Collection of all BugPatterns this detector reports.
 java.lang.String getShortName()
          Get the short name of the Detector.
 java.lang.String getSpeed()
          Get the speed of the Detector produced by this factory.
 boolean isDefaultEnabled()
          Is this factory enabled by default
 boolean isEnabled()
          Return whether the factory is enabled.
 boolean isFirstInPass()
          Return whether or not this detector needs to be first in its analysis pass.
 boolean isHidden()
          Get visibility of the factory (to GUI dialogs to configure detectors).
 void setDetailHTML(java.lang.String detailHTML)
          Set the HTML document describing the Detector.
 void setEnabled(boolean enabled)
          Set the enabled status of the factory.
 void setFirstInPass(boolean firstInPass)
          Mark whether or not this detector needs to be first in its analysis pass.
 void setHidden(boolean hidden)
          Set visibility of the factory (to GUI dialogs to configure detectors).
 void setPriorityAdjustment(int priorityAdjustment)
          Set the priority adjustment for the detector produced by this factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

plugin

private Plugin plugin

detectorClass

private final java.lang.Class detectorClass

enabled

private boolean enabled

defEnabled

private boolean defEnabled

speed

private final java.lang.String speed

reports

private final java.lang.String reports

requireJRE

private final java.lang.String requireJRE

detailHTML

private java.lang.String detailHTML

priorityAdjustment

private int priorityAdjustment

hidden

private boolean hidden

firstInPass

private boolean firstInPass

constructorArgTypes

private static final java.lang.Class[] constructorArgTypes
Constructor Detail

DetectorFactory

public DetectorFactory(Plugin plugin,
                       java.lang.Class detectorClass,
                       boolean enabled,
                       java.lang.String speed,
                       java.lang.String reports,
                       java.lang.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

getPlugin

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

Returns:
the Plugin this Detector is part of

isEnabled

public boolean isEnabled()
Return whether the factory is enabled. In addition to checked in the "enabled" attribute of the factory, this method checks that we are running on the minimum JRE version required by the detector.


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

isHidden

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


setEnabled

public void setEnabled(boolean enabled)
Set the enabled status of the factory.


isDefaultEnabled

public boolean isDefaultEnabled()
Is this factory enabled by default


setPriorityAdjustment

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

Parameters:
priorityAdjustment - the priority adjustment

getPriorityAdjustment

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

Returns:
the priority adjustment

setFirstInPass

public void setFirstInPass(boolean firstInPass)
Mark whether or not this detector needs to be first in its analysis pass.

Parameters:
firstInPass - true if the detector should be first in its pass, false if it does not

isFirstInPass

public boolean isFirstInPass()
Return whether or not this detector needs to be first in its analysis pass.


getSpeed

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


getReportedBugPatternCodes

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


getReportedBugPatterns

public java.util.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.


getDetailHTML

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


setDetailHTML

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


create

public Detector create(BugReporter bugReporter)
Create a Detector instance.

Parameters:
bugReporter - the BugReported to be used to report bugs
Returns:
the Detector

getShortName

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


getFullName

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