Package hudson.plugins.jacoco.model
Class CoverageObject<SELF extends CoverageObject<SELF>>
- java.lang.Object
-
- hudson.plugins.jacoco.model.CoverageObject<SELF>
-
- Type Parameters:
SELF
- self-type
- Direct Known Subclasses:
AbstractReport
,JacocoBuildAction
@ExportedBean public abstract class CoverageObject<SELF extends CoverageObject<SELF>> extends Object
Base class of all coverage objects.- Author:
- Kohsuke Kawaguchi, Martin Heinzerling
-
-
Constructor Summary
Constructors Constructor Description CoverageObject()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
doGraph(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
Generates the graph that shows the coverage trend up to this report.Api
getApi()
Coverage
getBranchCoverage()
abstract Run<?,?>
getBuild()
Gets the build object that owns the whole coverage report tree.Coverage
getClassCoverage()
Coverage
getComplexityScore()
Coverage
getInstructionCoverage()
Coverage
getLineCoverage()
Line coverage.int
getMaxBranch()
int
getMaxClazz()
int
getMaxComplexity()
int
getMaxInstruction()
int
getMaxLine()
int
getMaxMethod()
Coverage
getMethodCoverage()
CoverageObject<?>
getParent()
abstract SELF
getPreviousResult()
Gets the corresponding coverage report object in the previous run that has the record.boolean
hasClassCoverage()
boolean
hasLineCoverage()
boolean
isFailed()
String
printFourCoverageColumns()
Used in the view to print out four table columns with the coverage info.protected void
printRatioCell(boolean failed, Coverage ratio, StringBuilder buf)
protected void
printRatioTable(Coverage ratio, StringBuilder buf)
protected <ReportLevel extends AggregatedReport<?,?,?>>
voidsetAllCovTypes(ReportLevel reportToSet, org.jacoco.core.analysis.ICoverageNode covReport)
<ReportLevel extends AggregatedReport<?,?,?>>
voidsetCoverage(ReportLevel reportToSet, org.jacoco.core.analysis.ICoverageNode covReport)
void
setFailed()
Marks this coverage object as failed.void
setMaxBranch(int maxBranch)
void
setMaxClazz(int maxClazz)
void
setMaxComplexity(int maxComplexity)
void
setMaxInstruction(int maxInstruction)
void
setMaxLine(int maxLine)
void
setMaxMethod(int maxMethod)
String
toString()
-
-
-
Method Detail
-
getMaxClazz
public int getMaxClazz()
- Returns:
- the maxClazz
-
setMaxClazz
public void setMaxClazz(int maxClazz)
- Parameters:
maxClazz
- the maxClazz to set
-
getMaxMethod
public int getMaxMethod()
- Returns:
- the maxMethod
-
setMaxMethod
public void setMaxMethod(int maxMethod)
- Parameters:
maxMethod
- the maxMethod to set
-
getMaxLine
public int getMaxLine()
- Returns:
- the maxLine
-
setMaxLine
public void setMaxLine(int maxLine)
- Parameters:
maxLine
- the maxLine to set
-
getMaxComplexity
public int getMaxComplexity()
- Returns:
- the maxComplexity
-
setMaxComplexity
public void setMaxComplexity(int maxComplexity)
- Parameters:
maxComplexity
- the maxComplexity to set
-
getMaxInstruction
public int getMaxInstruction()
- Returns:
- the maxInstruction
-
setMaxInstruction
public void setMaxInstruction(int maxInstruction)
- Parameters:
maxInstruction
- the maxInstruction to set
-
getMaxBranch
public int getMaxBranch()
- Returns:
- the maxBranch
-
setMaxBranch
public void setMaxBranch(int maxBranch)
- Parameters:
maxBranch
- the maxBranch to set
-
isFailed
public boolean isFailed()
-
setFailed
public void setFailed()
Marks this coverage object as failed.- See Also:
Rule
-
getClassCoverage
@Exported(inline=true) public Coverage getClassCoverage()
-
getMethodCoverage
@Exported(inline=true) public Coverage getMethodCoverage()
-
getComplexityScore
@Exported(inline=true) public Coverage getComplexityScore()
-
getInstructionCoverage
@Exported(inline=true) public Coverage getInstructionCoverage()
-
getBranchCoverage
@Exported(inline=true) public Coverage getBranchCoverage()
-
getLineCoverage
@Exported(inline=true) public Coverage getLineCoverage()
Line coverage. Can be null if this information is not collected.- Returns:
- Line coverage.
-
getBuild
public abstract Run<?,?> getBuild()
Gets the build object that owns the whole coverage report tree.- Returns:
- the build object that owns the whole coverage report tree.
-
getPreviousResult
@Exported public abstract SELF getPreviousResult()
Gets the corresponding coverage report object in the previous run that has the record.- Returns:
- null if no earlier record was found.
-
getParent
public CoverageObject<?> getParent()
-
printFourCoverageColumns
public String printFourCoverageColumns()
Used in the view to print out four table columns with the coverage info.- Returns:
- HTML code.
-
hasLineCoverage
public boolean hasLineCoverage()
-
hasClassCoverage
public boolean hasClassCoverage()
-
printRatioCell
protected void printRatioCell(boolean failed, Coverage ratio, StringBuilder buf)
-
printRatioTable
protected void printRatioTable(Coverage ratio, StringBuilder buf)
-
setAllCovTypes
protected <ReportLevel extends AggregatedReport<?,?,?>> void setAllCovTypes(ReportLevel reportToSet, org.jacoco.core.analysis.ICoverageNode covReport)
-
setCoverage
public <ReportLevel extends AggregatedReport<?,?,?>> void setCoverage(ReportLevel reportToSet, org.jacoco.core.analysis.ICoverageNode covReport)
-
doGraph
public void doGraph(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException
Generates the graph that shows the coverage trend up to this report.- Parameters:
req
- Stapler request from which context, graph width and graph height are readrsp
- Stapler response to which is sent the graph- Throws:
IOException
- if any I/O error occurs
-
getApi
public Api getApi()
-
-