Package edu.umd.cs.findbugs.config
Class UserPreferences
- java.lang.Object
-
- edu.umd.cs.findbugs.config.UserPreferences
-
- All Implemented Interfaces:
java.lang.Cloneable
public class UserPreferences extends java.lang.Object implements java.lang.CloneableUser Preferences outside of any one Project. This consists of a class to manage the findbugs.prop file found in the user.home.- Author:
- Dave Brosius
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEFFORT_DEFAULTstatic java.lang.StringEFFORT_MAXstatic java.lang.StringEFFORT_MIN
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()static UserPreferencescreateDefaultUserPreferences()Create default UserPreferences.voidenableAllDetectors(boolean enable)Enable or disable all known Detectors.voidenableDetector(DetectorFactory factory, boolean enable)Set the enabled/disabled status of given Detector.booleanequals(java.lang.Object obj)AnalysisFeatureSetting[]getAnalysisFeatureSettings()Returns the effort level as an array of feature settings as expected by FindBugs.java.lang.StringgetEffort()java.util.Collection<java.lang.String>getExcludeBugsFiles()java.util.Collection<java.lang.String>getExcludeFilterFiles()ProjectFilterSettingsgetFilterSettings()Get ProjectFilterSettings.java.util.Collection<java.lang.String>getIncludeFilterFiles()java.util.List<java.lang.String>getRecentProjects()Get List of recent project filenames.intgetUserDetectorThreshold()Get the detector threshold (min severity to report a warning).static UserPreferencesgetUserPreferences()Get UserPreferences singleton.inthashCode()booleanisDetectorEnabled(DetectorFactory factory)Get the enabled/disabled status of given Detector.booleanisRunAtFullBuild()Get the enabled/disabled status of runAtFullBuildvoidread()Read persistent global UserPreferences from file in the user's home directory.voidread(java.io.InputStream in)Read user preferences from given input stream.voidremoveProject(java.lang.String projectName)Remove project filename from the recently-used project list.voidsetEffort(java.lang.String effort)voidsetExcludeBugsFiles(java.util.Collection<java.lang.String> excludeBugsFiles)voidsetExcludeFilterFiles(java.util.Collection<java.lang.String> excludeFilterFiles)voidsetIncludeFilterFiles(java.util.Collection<java.lang.String> includeFilterFiles)voidsetProjectFilterSettings(ProjectFilterSettings filterSettings)Set the ProjectFilterSettings.voidsetRunAtFullBuild(boolean enable)Set the enabled/disabled status of running findbugs automatically for full builds.voidsetUserDetectorThreshold(int threshold)Set the detector threshold (min severity to report a warning).voidsetUserDetectorThreshold(java.lang.String threshold)Set the detector threshold (min severity to report a warning).voiduseProject(java.lang.String projectName)Add given project filename to the front of the recently-used project list.voidwrite()Write persistent global UserPreferences to file in user's home directory.voidwrite(java.io.OutputStream out)Write UserPreferences to given OutputStream.
-
-
-
Field Detail
-
EFFORT_MIN
public static final java.lang.String EFFORT_MIN
- See Also:
- Constant Field Values
-
EFFORT_DEFAULT
public static final java.lang.String EFFORT_DEFAULT
- See Also:
- Constant Field Values
-
EFFORT_MAX
public static final java.lang.String EFFORT_MAX
- See Also:
- Constant Field Values
-
-
Method Detail
-
createDefaultUserPreferences
public static UserPreferences createDefaultUserPreferences()
Create default UserPreferences.- Returns:
- default UserPreferences
-
getUserPreferences
public static UserPreferences getUserPreferences()
Get UserPreferences singleton. This should only be used if there is a single set of user preferences to be used for all projects.- Returns:
- the UserPreferences
-
read
public void read()
Read persistent global UserPreferences from file in the user's home directory.
-
read
public void read(@WillClose java.io.InputStream in) throws java.io.IOExceptionRead user preferences from given input stream. The InputStream is guaranteed to be closed by this method.- Parameters:
in- the InputStream- Throws:
java.io.IOException
-
write
public void write()
Write persistent global UserPreferences to file in user's home directory.
-
write
public void write(@WillClose java.io.OutputStream out) throws java.io.IOExceptionWrite UserPreferences to given OutputStream. The OutputStream is guaranteed to be closed by this method.- Parameters:
out- the OutputStream- Throws:
java.io.IOException
-
getRecentProjects
public java.util.List<java.lang.String> getRecentProjects()
Get List of recent project filenames.- Returns:
- List of recent project filenames
-
useProject
public void useProject(java.lang.String projectName)
Add given project filename to the front of the recently-used project list.- Parameters:
projectName- project filename
-
removeProject
public void removeProject(java.lang.String projectName)
Remove project filename from the recently-used project list.- Parameters:
projectName- project filename
-
enableDetector
public void enableDetector(DetectorFactory factory, boolean enable)
Set the enabled/disabled status of given Detector.- Parameters:
factory- the DetectorFactory for the Detector to be enabled/disabledenable- true if the Detector should be enabled, false if it should be Disabled
-
isDetectorEnabled
public boolean isDetectorEnabled(DetectorFactory factory)
Get the enabled/disabled status of given Detector.- Parameters:
factory- the DetectorFactory of the Detector- Returns:
- true if the Detector is enabled, false if not
-
enableAllDetectors
public void enableAllDetectors(boolean enable)
Enable or disable all known Detectors.- Parameters:
enable- true if all detectors should be enabled, false if they should all be disabled
-
setProjectFilterSettings
public void setProjectFilterSettings(ProjectFilterSettings filterSettings)
Set the ProjectFilterSettings.- Parameters:
filterSettings- the ProjectFilterSettings
-
getFilterSettings
public ProjectFilterSettings getFilterSettings()
Get ProjectFilterSettings.- Returns:
- the ProjectFilterSettings
-
getUserDetectorThreshold
public int getUserDetectorThreshold()
Get the detector threshold (min severity to report a warning).- Returns:
- the detector threshold
-
setUserDetectorThreshold
public void setUserDetectorThreshold(int threshold)
Set the detector threshold (min severity to report a warning).- Parameters:
threshold- the detector threshold
-
setRunAtFullBuild
public void setRunAtFullBuild(boolean enable)
Set the enabled/disabled status of running findbugs automatically for full builds.- Parameters:
enable- true if running FindBugs at full builds should be enabled, false if it should be Disabled
-
isRunAtFullBuild
public boolean isRunAtFullBuild()
Get the enabled/disabled status of runAtFullBuild- Returns:
- true if the running for full builds is enabled, false if not
-
setUserDetectorThreshold
public void setUserDetectorThreshold(java.lang.String threshold)
Set the detector threshold (min severity to report a warning).- Parameters:
threshold- the detector threshold
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
clone
public java.lang.Object clone()
- Overrides:
clonein classjava.lang.Object
-
getEffort
public java.lang.String getEffort()
-
setEffort
public void setEffort(java.lang.String effort)
-
getIncludeFilterFiles
public java.util.Collection<java.lang.String> getIncludeFilterFiles()
-
setIncludeFilterFiles
public void setIncludeFilterFiles(java.util.Collection<java.lang.String> includeFilterFiles)
-
getExcludeBugsFiles
public java.util.Collection<java.lang.String> getExcludeBugsFiles()
-
setExcludeBugsFiles
public void setExcludeBugsFiles(java.util.Collection<java.lang.String> excludeBugsFiles)
-
setExcludeFilterFiles
public void setExcludeFilterFiles(java.util.Collection<java.lang.String> excludeFilterFiles)
-
getExcludeFilterFiles
public java.util.Collection<java.lang.String> getExcludeFilterFiles()
-
getAnalysisFeatureSettings
public AnalysisFeatureSetting[] getAnalysisFeatureSettings()
Returns the effort level as an array of feature settings as expected by FindBugs.- Returns:
- The array of feature settings corresponding to the current effort setting.
-
-