hudson.plugins.checkstyle.util.model
Class AbstractAnnotation

java.lang.Object
  extended by hudson.plugins.checkstyle.util.model.AbstractAnnotation
All Implemented Interfaces:
FileAnnotation, java.io.Serializable, java.lang.Comparable<FileAnnotation>
Direct Known Subclasses:
Warning

public abstract class AbstractAnnotation
extends java.lang.Object
implements FileAnnotation, java.io.Serializable

A base class for annotations.

Author:
Ulli Hafner
See Also:
Serialized Form

Constructor Summary
AbstractAnnotation(Priority priority, java.lang.String message, int start, int end, java.lang.String category, java.lang.String type)
          Creates a new instance of AbstractAnnotation.
 
Method Summary
 void addLineRange(LineRange lineRange)
          Adds another line range to this annotation.
 boolean canDisplayFile(hudson.model.AbstractBuild<?,?> owner)
          Checks if the file exists.
 int compareTo(FileAnnotation other)
          
 boolean equals(java.lang.Object obj)
           
 java.lang.String getCategory()
          Returns the category of the annotation.
 java.lang.String getFileName()
          Returns the absolute path of the workspace file that contains this annotation.
 long getKey()
          Returns the unique key of this annotation.
 java.util.Collection<LineRange> getLineRanges()
          Returns a collection of line ranges for this annotation.
 java.lang.String getMessage()
          Returns the message of this annotation.
 java.lang.String getModuleName()
          Returns the name of the maven or ant module that contains this annotation.
 java.lang.String getPackageName()
          Returns the name of package (or namespace) that contains this annotation.
 int getPrimaryLineNumber()
          Returns the primary line number of this annotation that defines the anchor of this annotation.
 Priority getPriority()
          Returns the priority of this annotation.
 java.lang.String getShortFileName()
          Gets the associated file name of this bug (without path).
 java.lang.String getTempName(hudson.model.AbstractBuild<?,?> owner)
          Returns a file name for a temporary file that will hold the contents of the source.
 java.lang.String getType()
          Returns the annotation type.
 int hashCode()
           
 void setFileName(java.lang.String fileName)
          Sets the file name to the specified value.
 void setModuleName(java.lang.String moduleName)
          Sets the module name to the specified value.
 void setPackageName(java.lang.String packageName)
          Sets the package name to the specified value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.plugins.checkstyle.util.model.FileAnnotation
getToolTip
 

Constructor Detail

AbstractAnnotation

public AbstractAnnotation(Priority priority,
                          java.lang.String message,
                          int start,
                          int end,
                          java.lang.String category,
                          java.lang.String type)
Creates a new instance of AbstractAnnotation.

Parameters:
priority - the priority
message - the message of the warning
start - the first line of the line range
end - the last line of the line range
category - the category of the annotation
type - the type of the annotation
Method Detail

getMessage

public java.lang.String getMessage()
Returns the message of this annotation.

Specified by:
getMessage in interface FileAnnotation
Returns:
the message of this annotation

getPriority

public Priority getPriority()
Returns the priority of this annotation.

Specified by:
getPriority in interface FileAnnotation
Returns:
the priority of this annotation

getKey

public final long getKey()
Returns the unique key of this annotation.

Specified by:
getKey in interface FileAnnotation
Returns:
the unique key of this annotation.

getFileName

public final java.lang.String getFileName()
Returns the absolute path of the workspace file that contains this annotation.

Specified by:
getFileName in interface FileAnnotation
Returns:
the name of the workspace file that contains this annotation

getTempName

public java.lang.String getTempName(hudson.model.AbstractBuild<?,?> owner)
Returns a file name for a temporary file that will hold the contents of the source. This temporary file is used in a master - slave scenario where the original file remains on the slave while this temporary file is transferred to the master.

Specified by:
getTempName in interface FileAnnotation
Parameters:
owner - the owner that provides the root directory where the files are stored
Returns:
the temporary name

getCategory

public java.lang.String getCategory()
Returns the category of the annotation. Might be an empty string if there is no category.

Specified by:
getCategory in interface FileAnnotation
Returns:
the annotation category

getType

public java.lang.String getType()
Returns the annotation type. Might be an empty string if there is no type.

Specified by:
getType in interface FileAnnotation
Returns:
the annotation type

setFileName

public final void setFileName(java.lang.String fileName)
Sets the file name to the specified value.

Specified by:
setFileName in interface FileAnnotation
Parameters:
fileName - the value to set

getModuleName

public final java.lang.String getModuleName()
Returns the name of the maven or ant module that contains this annotation.

Specified by:
getModuleName in interface FileAnnotation
Returns:
the name of the module that contains this annotation

setModuleName

public final void setModuleName(java.lang.String moduleName)
Sets the module name to the specified value.

Parameters:
moduleName - the value to set

getPackageName

public final java.lang.String getPackageName()
Returns the name of package (or namespace) that contains this annotation.

Specified by:
getPackageName in interface FileAnnotation
Returns:
the name of the package that contains this annotation

setPackageName

public final void setPackageName(java.lang.String packageName)
Sets the package name to the specified value.

Parameters:
packageName - the value to set

getLineRanges

public final java.util.Collection<LineRange> getLineRanges()
Returns a collection of line ranges for this annotation.

Specified by:
getLineRanges in interface FileAnnotation
Returns:
the collection of line ranges for this annotation.

getPrimaryLineNumber

public final int getPrimaryLineNumber()
Returns the primary line number of this annotation that defines the anchor of this annotation.

Specified by:
getPrimaryLineNumber in interface FileAnnotation
Returns:
the primary line number of this annotation

addLineRange

public void addLineRange(LineRange lineRange)
Adds another line range to this annotation.

Parameters:
lineRange - the line range to add

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getShortFileName

public java.lang.String getShortFileName()
Gets the associated file name of this bug (without path).

Specified by:
getShortFileName in interface FileAnnotation
Returns:
the short file name

canDisplayFile

public final boolean canDisplayFile(hudson.model.AbstractBuild<?,?> owner)
Checks if the file exists.

Specified by:
canDisplayFile in interface FileAnnotation
Parameters:
owner - the owner that provides the root directory where the files are stored
Returns:
true, if successful

compareTo

public int compareTo(FileAnnotation other)

Specified by:
compareTo in interface java.lang.Comparable<FileAnnotation>


Copyright © 2008. All Rights Reserved.