Class CoverageObject<SELF extends 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
    • Field Detail

      • complexity

        public Coverage complexity
      • instruction

        public Coverage instruction
      • maxClazz

        public int maxClazz
        Variables used to store which child has to highest coverage for each coverage type.
      • maxMethod

        public int maxMethod
      • maxLine

        public int maxLine
      • maxComplexity

        public int maxComplexity
      • maxInstruction

        public int maxInstruction
      • maxBranch

        public int maxBranch
    • Constructor Detail

      • CoverageObject

        public CoverageObject()
    • 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.
      • 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)
      • 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 read
        rsp - Stapler response to which is sent the graph
        Throws:
        IOException - if any I/O error occurs
      • getApi

        public Api getApi()