FindBugs™ 1.3.9

edu.umd.cs.findbugs
Class Project

java.lang.Object
  extended by edu.umd.cs.findbugs.Project
All Implemented Interfaces:
XMLWriteable

public class Project
extends java.lang.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 java.lang.String RELATIVE_PATHS
           
static java.lang.String UNNAMED_PROJECT
          Constant used to name anonymous projects.
 
Constructor Summary
Project()
          Create an anonymous project.
 
Method Summary
 void add(Project project2)
          add information from project2 to this project
 boolean addAuxClasspathEntry(java.lang.String auxClasspathEntry)
          Add an auxiliary classpath entry
 boolean addFile(java.lang.String fileName)
          Add a file to the project.
 boolean addSourceDir(java.lang.String dirName)
          Add a source directory to the project.
 void addTimestamp(long timestamp)
           
 boolean addWorkingDir(java.lang.String dirName)
          Add a working directory to the project.
static
<T> java.util.List<T>
appendWithoutDuplicates(java.util.List<T> lst1, java.util.List<T> lst2)
           
 Project duplicate()
          Return an exact copy of this Project.
 java.lang.String getAuxClasspathEntry(int n)
          Get the n'th auxiliary classpath entry.
 java.util.List<java.lang.String> getAuxClasspathEntryList()
          Return the list of aux classpath entries.
 java.lang.String getFile(int num)
          Get the given file in the list of project files.
 java.lang.String[] getFileArray()
          Get project files as an array of Strings.
 int getFileCount()
          Get the number of files in the project.
 java.util.List<java.lang.String> getFileList()
          Get the list of files, directories, and zip files in the project.
 IGuiCallback getGuiCallback()
           
 java.util.List<java.lang.String> getImplicitClasspathEntryList()
          Deprecated. FindBugs2 and ClassPathBuilder take care of this automatically
 int getNumAuxClasspathEntries()
          Get the number of auxiliary classpath entries.
 int getNumSourceDirs()
          Get the number of source directories in the project.
 boolean getOption(java.lang.String option)
          Deprecated. 
 java.lang.String getProjectFileName()
          Deprecated. 
 java.lang.String getProjectName()
           
 java.lang.Iterable<java.lang.String> getResolvedSourcePaths()
           
 java.lang.String getSourceDir(int num)
          Get the given source directory.
 java.lang.String[] getSourceDirArray()
          Get source dirs as an array of Strings.
 java.util.List<java.lang.String> getSourceDirList()
          Get the source dir list.
 SourceFinder getSourceFinder()
           
 Filter getSuppressionFilter()
           
 long getTimestamp()
           
 boolean isGuiAvaliable()
           
 boolean isModified()
          Return whether or not this Project has unsaved modifications.
 java.lang.String projectNameFromProjectFileName()
           
 void read(java.lang.String inputFile)
          Deprecated. 
static Project readProject(java.lang.String argument)
          Read Project from named file.
static Project readXML(java.io.File f)
           
 void removeAuxClasspathEntry(int n)
          Remove the n'th auxiliary classpath entry.
 void removeFile(int num)
          Remove file at the given index in the list of project files
 void removeSourceDir(int num)
          Remove source directory at given index.
 void setCurrentWorkingDirectory(java.io.File f)
           
 void setGuiCallback(IGuiCallback guiCallback)
           
 void setModified(boolean isModified)
          Set whether or not this Project has unsaved modifications.
 void setProjectFileName(java.lang.String projectFileName)
          Deprecated. 
 void setProjectName(java.lang.String projectName)
           
 void setSuppressionFilter(Filter suppressionFilter)
           
 void setTimestamp(long timestamp)
           
 java.lang.String toString()
          Convert to a string in a nice (displayable) format.
static java.lang.String transformFilename(java.lang.String fileName)
          Transform a user-entered filename into a proper filename, by adding the ".fb" file extension if it isn't already present.
 void write(java.lang.String outputFile, boolean useRelativePaths, java.lang.String relativeBase)
          Deprecated. 
 void writeXML(java.io.File f)
           
 void writeXML(XMLOutput xmlOutput)
          Write this object to given XMLOutput.
 void writeXML(XMLOutput xmlOutput, java.lang.Object destination)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNNAMED_PROJECT

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

See Also:
Constant Field Values

RELATIVE_PATHS

public static final java.lang.String RELATIVE_PATHS
See Also:
Constant Field Values
Constructor Detail

Project

public Project()
Create an anonymous project.

Method Detail

duplicate

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


getSourceFinder

public SourceFinder getSourceFinder()

isGuiAvaliable

public boolean isGuiAvaliable()

add

public void add(Project project2)
add information from project2 to this project


appendWithoutDuplicates

public static <T> java.util.List<T> appendWithoutDuplicates(java.util.List<T> lst1,
                                                            java.util.List<T> lst2)

setCurrentWorkingDirectory

public void setCurrentWorkingDirectory(java.io.File f)

isModified

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


setModified

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


getProjectFileName

@Deprecated
public java.lang.String getProjectFileName()
Deprecated. 

Get the project filename.


setProjectFileName

@Deprecated
public void setProjectFileName(java.lang.String projectFileName)
Deprecated. 

Set the project filename.

Parameters:
projectFileName - the new filename

addFile

public boolean addFile(java.lang.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(java.lang.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

addWorkingDir

public boolean addWorkingDir(java.lang.String dirName)
Add a working directory to the project.

Parameters:
dirName - the directory to add
Returns:
true if the working directory was added, or false if the working directory was already present

getOption

@Deprecated
public boolean getOption(java.lang.String option)
Deprecated. 

Retrieve the Options value.

Parameters:
option - the name of option to get
Returns:
the value of the option

getFileCount

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

Returns:
the number of files in the project

getFile

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

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

getFileList

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


getNumSourceDirs

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

Returns:
the number of source directories in the project

getSourceDir

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

Parameters:
num - the number of the source directory
Returns:
the source directory

removeSourceDir

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

Parameters:
num - index of the source directory to remove

getFileArray

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


getSourceDirArray

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


getSourceDirList

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


addAuxClasspathEntry

public boolean addAuxClasspathEntry(java.lang.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

getNumAuxClasspathEntries

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


getAuxClasspathEntry

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


removeAuxClasspathEntry

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


getAuxClasspathEntryList

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


getImplicitClasspathEntryList

@Deprecated
public java.util.List<java.lang.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.


write

@Deprecated
public void write(java.lang.String outputFile,
                             boolean useRelativePaths,
                             java.lang.String relativeBase)
           throws java.io.IOException
Deprecated. 

Save the project to an output file.

Parameters:
outputFile - name of output file
useRelativePaths - true if the project should be written using only relative paths
relativeBase - if useRelativePaths is true, this file is taken as the base directory in terms of which all files should be made relative
Throws:
java.io.IOException - if an error occurs while writing

readXML

public static Project readXML(java.io.File f)
                       throws java.io.IOException,
                              org.dom4j.DocumentException,
                              org.xml.sax.SAXException
Throws:
java.io.IOException
org.dom4j.DocumentException
org.xml.sax.SAXException

writeXML

public void writeXML(java.io.File f)
              throws java.io.IOException
Throws:
java.io.IOException

read

@Deprecated
public void read(java.lang.String inputFile)
          throws java.io.IOException
Deprecated. 

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:
java.io.IOException - if an error occurs while reading

readProject

public static Project readProject(java.lang.String argument)
                           throws java.io.IOException
Read Project from named file.

Parameters:
argument - command line argument containing project file name
Returns:
the Project
Throws:
java.io.IOException

projectNameFromProjectFileName

public java.lang.String projectNameFromProjectFileName()

toString

public java.lang.String toString()
Convert to a string in a nice (displayable) format.

Overrides:
toString in class java.lang.Object

transformFilename

public static java.lang.String transformFilename(java.lang.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(XMLOutput xmlOutput)
              throws java.io.IOException
Description copied from interface: XMLWriteable
Write this object to given XMLOutput.

Specified by:
writeXML in interface XMLWriteable
Parameters:
xmlOutput - the XMLOutput for the document
Throws:
java.io.IOException

writeXML

public void writeXML(XMLOutput xmlOutput,
                     @CheckForNull
                     java.lang.Object destination)
              throws java.io.IOException
Throws:
java.io.IOException

setTimestamp

public void setTimestamp(long timestamp)
Parameters:
timestamp - The timestamp to set.

addTimestamp

public void addTimestamp(long timestamp)

getTimestamp

public long getTimestamp()
Returns:
Returns the timestamp.

setProjectName

public void setProjectName(java.lang.String projectName)
Parameters:
projectName - The projectName to set.

getProjectName

public java.lang.String getProjectName()
Returns:
Returns the projectName.

setSuppressionFilter

public void setSuppressionFilter(Filter suppressionFilter)
Parameters:
suppressionFilter - The suppressionFilter to set.

getSuppressionFilter

public Filter getSuppressionFilter()
Returns:
Returns the suppressionFilter.

setGuiCallback

public void setGuiCallback(IGuiCallback guiCallback)

getGuiCallback

public IGuiCallback getGuiCallback()

getResolvedSourcePaths

public java.lang.Iterable<java.lang.String> getResolvedSourcePaths()
Returns:

FindBugs™ 1.3.9

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