edu.umd.cs.findbugs

Class PackageMemberAnnotation

public abstract class PackageMemberAnnotation extends Object implements BugAnnotation

Abstract base class for BugAnnotations describing constructs which are contained in a Java package. Specifically, this includes classes, methods, and fields.

Author: David Hovemeyer

See Also: BugAnnotation

Field Summary
protected StringclassName
protected Stringdescription
protected StringsourceFileName
protected SourceLineAnnotationsourceLines
Constructor Summary
protected PackageMemberAnnotation(String className, String description)
Constructor.
Method Summary
Stringformat(String key, ClassAnnotation primaryClass)
Format the annotation.
protected abstract StringformatPackageMember(String key, ClassAnnotation primaryClass)
Do default and subclass-specific formatting.
StringgetClassName()
Get the class name.
StringgetDescription()
StringgetPackageName()
Get the package name.
StringgetSourceFileName()
Get the source file name.
SourceLineAnnotationgetSourceLines()
Get the SourceLineAnnotation describing the source lines where the method is defined.
booleanisSignificant()
protected static StringremovePackageName(String typeName)
Shorten a type name by removing the package name
voidsetDescription(String description)
voidsetSourceLines(SourceLineAnnotation sourceLines)
Set a SourceLineAnnotation describing the source lines where the package element is defined.
protected static Stringshorten(String pkgName, String typeName)
Shorten a type name of remove extraneous components.

Field Detail

className

protected String className

description

protected String description

sourceFileName

protected String sourceFileName

sourceLines

protected SourceLineAnnotation sourceLines

Constructor Detail

PackageMemberAnnotation

protected PackageMemberAnnotation(String className, String description)
Constructor.

Parameters: className name of the class

Method Detail

format

public final String format(String key, ClassAnnotation primaryClass)
Format the annotation. Note that this version (defined by PackageMemberAnnotation) only handles the "class" and "package" keys, and calls formatPackageMember() for all other keys.

Parameters: key the key

Returns: the formatted annotation

formatPackageMember

protected abstract String formatPackageMember(String key, ClassAnnotation primaryClass)
Do default and subclass-specific formatting.

Parameters: key the key specifying how to do the formatting primaryClass TODO

getClassName

public final String getClassName()
Get the class name.

getDescription

public String getDescription()

getPackageName

public final String getPackageName()
Get the package name.

getSourceFileName

public final String getSourceFileName()
Get the source file name.

getSourceLines

public SourceLineAnnotation getSourceLines()
Get the SourceLineAnnotation describing the source lines where the method is defined.

Returns: the SourceLineAnnotation, or null if there is no source information for this package element

isSignificant

public boolean isSignificant()

removePackageName

protected static String removePackageName(String typeName)
Shorten a type name by removing the package name

setDescription

public void setDescription(String description)

setSourceLines

public void setSourceLines(SourceLineAnnotation sourceLines)
Set a SourceLineAnnotation describing the source lines where the package element is defined.

shorten

protected static String shorten(String pkgName, String typeName)
Shorten a type name of remove extraneous components. Candidates for shortening are classes in same package as this annotation and classes in the java.lang package.
FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.