java.lang.Object
edu.hm.hafner.analysis.IssueBuilder
- Alle implementierten Schnittstellen:
AutoCloseable
Creates new
issues using the builder pattern. All properties that have not been set in the builder will
be set to their default value.
Example:
Issue issue = new IssueBuilder()
.setFileName("affected.file")
.setLineStart(0)
.setCategory("JavaDoc")
.setMessage("Missing JavaDoc")
.setSeverity(Severity.WARNING_LOW);
- Autor:
- Ullrich Hafner
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungbuild()Creates a newIssuebased on the specified properties.Creates a newIssuebased on the specified properties.Creates a newIssuebased on the specified properties.voidclose()Reduce the memory print of internal string instances.Initializes this builder with an exact copy of all properties of the specified issue.guessSeverity(String severityString) Guesses a severity for the issues: converts a String severity to one of the predefined severities.setAdditionalProperties(Serializable additionalProperties) Sets additional properties from the statical analysis tool.setCategory(String category) Sets the category of this issue (depends on the available categories of the static analysis tool).setColumnEnd(int columnEnd) Sets the the last column of this issue (columns start at 1).setColumnEnd(String columnEnd) Sets the the last column of this issue (columns start at 1).setColumnStart(int columnStart) Sets the first column of this issue (columns start at 1, 0 indicates the whole line).setColumnStart(String columnStart) Sets the first column of this issue (columns start at 1, 0 indicates the whole line).setDescription(String description) Sets an additional description for this issue.setDirectory(String directory) Sets the current work directory.setFileName(String fileName) Sets the name of the affected file.setFingerprint(String fingerprint) Sets the fingerprint for this issue.Sets the unique ID of the issue.setLineEnd(int lineEnd) Sets the last line of this issue (lines start at 1).setLineEnd(String lineEnd) Sets the last line of this issue (lines start at 1).setLineRanges(LineRangeList lineRanges) Sets additional line ranges for this issue.setLineStart(int lineStart) Sets the first line of this issue (lines start at 1; 0 indicates the whole file).setLineStart(String lineStart) Sets the first line of this issue (lines start at 1; 0 indicates the whole file).setMessage(String message) Sets the detailed message for this issue.setModuleName(String moduleName) Sets the name of the module or project (or similar concept) that contains this issue.Sets the ID of the tool that did report this issue.setOriginName(String originName) Sets the name of the tool that did report this issue.setPackageName(String packageName) Sets the name of the package or name space (or similar concept) that contains this issue.setPathName(String pathName) Sets the path of the affected file.setReference(String reference) Sets a reference to the execution of the static analysis tool (build ID, timestamp, etc.).setSeverity(Severity severity) Sets the severity of this issue.Sets the type of this issue (depends on the available types of the static analysis tool).
-
Konstruktordetails
-
IssueBuilder
public IssueBuilder()
-
-
Methodendetails
-
setId
Sets the unique ID of the issue. If not set then an ID will be generated.- Parameter:
id- the ID- Gibt zurück:
- this
-
setAdditionalProperties
Sets additional properties from the statical analysis tool. This object could be used to store tool specific information.- Parameter:
additionalProperties- the instance- Gibt zurück:
- this
-
setFingerprint
Sets the fingerprint for this issue. Used to decide if two issues are equal even if the equals method returnsfalsesince some of the properties differ due to code refactorings. The fingerprint is created by analyzing the content of the affected file.- Parameter:
fingerprint- the fingerprint to set- Gibt zurück:
- this
-
setFileName
Sets the name of the affected file. This file name is a path relative to the path of the affected files (seesetPathName(String)).- Parameter:
fileName- the file name- Gibt zurück:
- this
-
setDirectory
Sets the current work directory. This directory is used as prefix for all subsequent issue file names. If the path is set as well, then the final path of an issue is the concatenation ofpath,directory, andfileName. Note that this directory is not visible later on, the issue does only store the path in thepathandfileNameproperties. I.e., the created issue will get a new file name that is composed ofdirectoryandfileName.- Parameter:
directory- the directory that contains all affected files- Gibt zurück:
- this
-
setPathName
Sets the path of the affected file. Note that this path is not the parent folder of the affected file. This path is the folder that contains all of the affected files of aReport. The path of an affected file is stored in thepathandfileNameproperties so that issues can be tracked even if the root folder changes (due to different build environments).- Parameter:
pathName- the path that contains all affected files- Gibt zurück:
- this
-
setLineStart
Sets the first line of this issue (lines start at 1; 0 indicates the whole file).- Parameter:
lineStart- the first line- Gibt zurück:
- this
-
setLineStart
Sets the first line of this issue (lines start at 1; 0 indicates the whole file).- Parameter:
lineStart- the first line- Gibt zurück:
- this
-
setLineEnd
Sets the last line of this issue (lines start at 1).- Parameter:
lineEnd- the last line- Gibt zurück:
- this
-
setLineEnd
Sets the last line of this issue (lines start at 1).- Parameter:
lineEnd- the last line- Gibt zurück:
- this
-
setColumnStart
Sets the first column of this issue (columns start at 1, 0 indicates the whole line).- Parameter:
columnStart- the first column- Gibt zurück:
- this
-
setColumnStart
Sets the first column of this issue (columns start at 1, 0 indicates the whole line).- Parameter:
columnStart- the first column- Gibt zurück:
- this
-
setColumnEnd
Sets the the last column of this issue (columns start at 1).- Parameter:
columnEnd- the last column- Gibt zurück:
- this
-
setColumnEnd
Sets the the last column of this issue (columns start at 1).- Parameter:
columnEnd- the last column- Gibt zurück:
- this
-
setCategory
Sets the category of this issue (depends on the available categories of the static analysis tool). Examples for categories are "Deprecation", "Design", or "JavaDoc".- Parameter:
category- the category- Gibt zurück:
- this
-
setType
Sets the type of this issue (depends on the available types of the static analysis tool). The type typically is the associated rule of the static analysis tool that reported this issue.- Parameter:
type- the type- Gibt zurück:
- this
-
setPackageName
Sets the name of the package or name space (or similar concept) that contains this issue.- Parameter:
packageName- the package or namespace name- Gibt zurück:
- this
-
setModuleName
Sets the name of the module or project (or similar concept) that contains this issue.- Parameter:
moduleName- the module name- Gibt zurück:
- this
-
setOrigin
Sets the ID of the tool that did report this issue.- Parameter:
origin- the ID of the originating tool- Gibt zurück:
- this
-
setOriginName
Sets the name of the tool that did report this issue.- Parameter:
originName- the ID of the originating tool- Gibt zurück:
- this
-
setReference
Sets a reference to the execution of the static analysis tool (build ID, timestamp, etc.).- Parameter:
reference- the reference- Gibt zurück:
- this
-
setSeverity
Sets the severity of this issue.- Parameter:
severity- the severity- Gibt zurück:
- this
-
guessSeverity
Guesses a severity for the issues: converts a String severity to one of the predefined severities. If the provided String does not match (even partly) then the default severity will be returned.- Parameter:
severityString- the severity given as a string representation- Gibt zurück:
- this
-
setMessage
Sets the detailed message for this issue.- Parameter:
message- the message- Gibt zurück:
- this
-
setDescription
Sets an additional description for this issue. Static analysis tools might provide some additional information about this issue. This description may contain valid HTML.- Parameter:
description- the description (as HTML content)- Gibt zurück:
- this
-
setLineRanges
Sets additional line ranges for this issue. Not that the primary range given bylineStartand* lineEndis not included.- Parameter:
lineRanges- the additional line ranges- Gibt zurück:
- this
-
copy
Initializes this builder with an exact copy of all properties of the specified issue.- Parameter:
copy- the issue to copy the properties from- Gibt zurück:
- the initialized builder
-
build
Creates a newIssuebased on the specified properties. After building the issue, thisIssueBuildercreates a new ID, but all otherIssueproperties will remain unchanged.- Gibt zurück:
- the created issue
-
buildAndClean
Creates a newIssuebased on the specified properties. After building the issue, thisIssueBuilderwill be reset to its defaults.- Gibt zurück:
- the created issue
-
buildOptional
Creates a newIssuebased on the specified properties. The returned issue is wrapped in anOptional. After building the issue, thisIssueBuilderwill be reset to its defaults.- Gibt zurück:
- the created issue
- Siehe auch:
-
close
public void close()Reduce the memory print of internal string instances.- Angegeben von:
closein SchnittstelleAutoCloseable
-