edu.umd.cs.findbugs

Class Project

public class Project extends Object implements XMLWriteable

A project in the GUI. This consists of some number of Jar files to analyze for bugs, and optionally

Author: David Hovemeyer

Field Summary
static StringRELATIVE_PATHS
static StringUNNAMED_PROJECT
Constant used to name anonymous projects.
Constructor Summary
Project()
Create an anonymous project.
Method Summary
booleanaddAuxClasspathEntry(String auxClasspathEntry)
Add an auxiliary classpath entry
booleanaddFile(String fileName)
Add a file to the project.
booleanaddSourceDir(String dirName)
Add a source directory to the project.
voidaddTimestamp(long timestamp)
Projectduplicate()
Return an exact copy of this Project.
StringgetAuxClasspathEntry(int n)
Get the n'th auxiliary classpath entry.
List<String>getAuxClasspathEntryList()
Return the list of aux classpath entries.
StringgetFile(int num)
Get the given file in the list of project files.
String[]getFileArray()
Get project files as an array of Strings.
intgetFileCount()
Get the number of files in the project.
List<String>getFileList()
Get the list of files, directories, and zip files in the project.
List<String>getImplicitClasspathEntryList()
Return the list of implicit classpath entries.
intgetNumAuxClasspathEntries()
Get the number of auxiliary classpath entries.
intgetNumSourceDirs()
Get the number of source directories in the project.
booleangetOption(String option)
Retrieve the Options value.
StringgetProjectName()
StringgetSourceDir(int num)
Get the given source directory.
String[]getSourceDirArray()
Get source dirs as an array of Strings.
List<String>getSourceDirList()
Get the source dir list.
FiltergetSuppressionFilter()
longgetTimestamp()
booleanisModified()
Return whether or not this Project has unsaved modifications.
StringprojectNameFromProjectFileName()
voidread(String inputFile)
Read the project from an input file.
static ProjectreadXML(File f)
voidremoveAuxClasspathEntry(int n)
Remove the n'th auxiliary classpath entry.
voidremoveFile(int num)
Remove file at the given index in the list of project files
voidremoveSourceDir(int num)
Remove source directory at given index.
voidsetCurrentWorkingDirectory(File f)
voidsetModified(boolean isModified)
Set whether or not this Project has unsaved modifications.
voidsetProjectName(String projectName)
voidsetSuppressionFilter(Filter suppressionFilter)
voidsetTimestamp(long timestamp)
static StringtransformFilename(String fileName)
Transform a user-entered filename into a proper filename, by adding the ".fb" file extension if it isn't already present.
voidwriteXML(File f)
voidwriteXML(XMLOutput xmlOutput)

Field Detail

RELATIVE_PATHS

public static final String RELATIVE_PATHS

UNNAMED_PROJECT

public static final String UNNAMED_PROJECT
Constant used to name anonymous projects.

Constructor Detail

Project

public Project()
Create an anonymous project.

Method Detail

addAuxClasspathEntry

public boolean addAuxClasspathEntry(String auxClasspathEntry)
Add an auxiliary classpath entry

Parameters: auxClasspathEntry the entry

Returns: true if the entry was added successfully, or false if the given entry is already in the list

addFile

public boolean addFile(String fileName)
Add a file to the project.

Parameters: fileName the file to add

Returns: true if the file was added, or false if the file was already present

addSourceDir

public boolean addSourceDir(String dirName)
Add a source directory to the project.

Parameters: dirName the directory to add

Returns: true if the source directory was added, or false if the source directory was already present

addTimestamp

public void addTimestamp(long timestamp)

duplicate

public Project duplicate()
Return an exact copy of this Project.

getAuxClasspathEntry

public String getAuxClasspathEntry(int n)
Get the n'th auxiliary classpath entry.

getAuxClasspathEntryList

public List<String> getAuxClasspathEntryList()
Return the list of aux classpath entries.

getFile

public String getFile(int num)
Get the given file in the list of project files.

Parameters: num the number of the file in the list of project files

Returns: the name of the file

getFileArray

public String[] getFileArray()
Get project files as an array of Strings.

getFileCount

public int getFileCount()
Get the number of files in the project.

Returns: the number of files in the project

getFileList

public List<String> getFileList()
Get the list of files, directories, and zip files in the project.

getImplicitClasspathEntryList

public List<String> getImplicitClasspathEntryList()

Deprecated: FindBugs2 and ClassPathBuilder take care of this automatically

Return the list of implicit classpath entries. The implicit classpath is computed from the closure of the set of jar files that are referenced by the "Class-Path" attribute of the manifest of the any jar file that is part of this project or by the "Class-Path" attribute of any directly or indirectly referenced jar. The referenced jar files that exist are the list of implicit classpath entries.

getNumAuxClasspathEntries

public int getNumAuxClasspathEntries()
Get the number of auxiliary classpath entries.

getNumSourceDirs

public int getNumSourceDirs()
Get the number of source directories in the project.

Returns: the number of source directories in the project

getOption

public boolean getOption(String option)
Retrieve the Options value.

Parameters: option the name of option to get

Returns: the value of the option

getProjectName

public String getProjectName()

Returns: Returns the projectName.

getSourceDir

public String getSourceDir(int num)
Get the given source directory.

Parameters: num the number of the source directory

Returns: the source directory

getSourceDirArray

public String[] getSourceDirArray()
Get source dirs as an array of Strings.

getSourceDirList

public List<String> getSourceDirList()
Get the source dir list.

getSuppressionFilter

public Filter getSuppressionFilter()

Returns: Returns the suppressionFilter.

getTimestamp

public long getTimestamp()

Returns: Returns the timestamp.

isModified

public boolean isModified()
Return whether or not this Project has unsaved modifications.

projectNameFromProjectFileName

public String projectNameFromProjectFileName()

read

public void read(String inputFile)
Read the project from an input file. This method should only be used on an empty Project (created with the default constructor).

Parameters: inputFile name of the input file to read the project from

Throws: IOException if an error occurs while reading

readXML

public static Project readXML(File f)

removeAuxClasspathEntry

public void removeAuxClasspathEntry(int n)
Remove the n'th auxiliary classpath entry.

removeFile

public void removeFile(int num)
Remove file at the given index in the list of project files

Parameters: num index of the file to remove in the list of project files

removeSourceDir

public void removeSourceDir(int num)
Remove source directory at given index.

Parameters: num index of the source directory to remove

setCurrentWorkingDirectory

public void setCurrentWorkingDirectory(File f)

setModified

public void setModified(boolean isModified)
Set whether or not this Project has unsaved modifications.

setProjectName

public void setProjectName(String projectName)

Parameters: projectName The projectName to set.

setSuppressionFilter

public void setSuppressionFilter(Filter suppressionFilter)

Parameters: suppressionFilter The suppressionFilter to set.

setTimestamp

public void setTimestamp(long timestamp)

Parameters: timestamp The timestamp to set.

transformFilename

public static String transformFilename(String fileName)
Transform a user-entered filename into a proper filename, by adding the ".fb" file extension if it isn't already present.

writeXML

public void writeXML(File f)

writeXML

public void writeXML(XMLOutput xmlOutput)
FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.