org.jacoco.core.analysis
Class CoverageBuilder

java.lang.Object
  extended by org.jacoco.core.analysis.CoverageBuilder
All Implemented Interfaces:
ICoverageVisitor

public class CoverageBuilder
extends Object
implements ICoverageVisitor

Builder for hierarchical ICoverageNode structures from single IClassCoverage nodes. The nodes are feed into the builder through its ICoverageVisitor interface. Afterwards the aggregated data can be obtained with getClasses(), getSourceFiles() or getBundle(String) in the following hierarchy:

 IBundleCoverage
 +-- IPackageCoverage*
     +-- IClassCoverage*
     +-- ISourceFileCoverage*
 


Constructor Summary
CoverageBuilder()
          Create a new builder.
 
Method Summary
 IBundleCoverage getBundle(String name)
          Creates a bundle from all nodes currently contained in this bundle.
 Collection<IClassCoverage> getClasses()
          Returns all class nodes currently contained in this builder.
 Collection<IClassCoverage> getNoMatchClasses()
          Returns all classes for which execution data does not match.
 Collection<ISourceFileCoverage> getSourceFiles()
          Returns all source file nodes currently contained in this builder.
 void visitCoverage(IClassCoverage coverage)
          For analyzed class coverage data is emitted to this method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CoverageBuilder

public CoverageBuilder()
Create a new builder.

Method Detail

getClasses

public Collection<IClassCoverage> getClasses()
Returns all class nodes currently contained in this builder.

Returns:
all class nodes

getSourceFiles

public Collection<ISourceFileCoverage> getSourceFiles()
Returns all source file nodes currently contained in this builder.

Returns:
all source file nodes

getBundle

public IBundleCoverage getBundle(String name)
Creates a bundle from all nodes currently contained in this bundle.

Parameters:
name - Name of the bundle
Returns:
bundle containing all classes and source files

getNoMatchClasses

public Collection<IClassCoverage> getNoMatchClasses()
Returns all classes for which execution data does not match.

Returns:
collection of classes with non-matching execution data
See Also:
IClassCoverage.isNoMatch()

visitCoverage

public void visitCoverage(IClassCoverage coverage)
Description copied from interface: ICoverageVisitor
For analyzed class coverage data is emitted to this method.

Specified by:
visitCoverage in interface ICoverageVisitor
Parameters:
coverage - coverage data for a class


Copyright © 2009–2023 Mountainminds GmbH & Co. KG. All rights reserved.