Package org.jacoco.report.internal.xml
Class ReportElement
- java.lang.Object
-
- org.jacoco.report.internal.xml.XMLElement
-
- org.jacoco.report.internal.xml.ReportElement
-
public class ReportElement extends XMLElement
AXMLElementwith utility methods to create JaCoCo XML reports.
-
-
Field Summary
-
Fields inherited from class org.jacoco.report.internal.xml.XMLElement
writer
-
-
Constructor Summary
Constructors Constructor Description ReportElement(java.lang.String name, java.io.OutputStream output, java.lang.String encoding)Creates areportroot element for a XML report.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ReportElementclassElement(IClassCoverage coverage)Creates a 'class' element.voidcounter(ICoverageNode.CounterEntity counterEntity, ICounter counter)Creates a 'counter' element.ReportElementelement(java.lang.String name)Creates a new child element for this element.ReportElementgroup(java.lang.String name)Creates a 'group' element.voidline(int nr, ILine line)Creates a 'line' element.ReportElementmethod(IMethodCoverage coverage)Creates a 'method' element.ReportElementpackageElement(java.lang.String name)Creates a 'package' element.voidsessioninfo(SessionInfo info)Creates a 'sessioninfo' element.ReportElementsourcefile(java.lang.String name)Creates a 'sourcefile' element.
-
-
-
Constructor Detail
-
ReportElement
public ReportElement(java.lang.String name, java.io.OutputStream output, java.lang.String encoding) throws java.io.IOExceptionCreates areportroot element for a XML report.- Parameters:
name- value for the name attributeencoding- character encoding used for outputoutput- output stream will be closed if the root element is closed- Throws:
java.io.IOException- in case of problems with the underlying output
-
-
Method Detail
-
element
public ReportElement element(java.lang.String name) throws java.io.IOException
Description copied from class:XMLElementCreates a new child element for this element. Might be overridden in subclasses to return a instance of the subclass.- Overrides:
elementin classXMLElement- Parameters:
name- name of the child element- Returns:
- child element instance
- Throws:
java.io.IOException- in case of problems with the underlying output
-
sessioninfo
public void sessioninfo(SessionInfo info) throws java.io.IOException
Creates a 'sessioninfo' element.- Parameters:
info- info object to write out- Throws:
java.io.IOException- in case of problems with the underlying output
-
group
public ReportElement group(java.lang.String name) throws java.io.IOException
Creates a 'group' element.- Parameters:
name- value for the name attribute- Returns:
- 'group' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
packageElement
public ReportElement packageElement(java.lang.String name) throws java.io.IOException
Creates a 'package' element.- Parameters:
name- value for the name attribute- Returns:
- 'package' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
classElement
public ReportElement classElement(IClassCoverage coverage) throws java.io.IOException
Creates a 'class' element.- Parameters:
coverage- class coverage node to write out- Returns:
- 'class' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
method
public ReportElement method(IMethodCoverage coverage) throws java.io.IOException
Creates a 'method' element.- Parameters:
coverage- method coverage node to write out- Returns:
- 'method' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
sourcefile
public ReportElement sourcefile(java.lang.String name) throws java.io.IOException
Creates a 'sourcefile' element.- Parameters:
name- value for the name attribute- Returns:
- 'sourcefile' element
- Throws:
java.io.IOException- in case of problems with the underlying output
-
line
public void line(int nr, ILine line) throws java.io.IOExceptionCreates a 'line' element.- Parameters:
nr- line numberline- line object to write out- Throws:
java.io.IOException- in case of problems with the underlying output
-
counter
public void counter(ICoverageNode.CounterEntity counterEntity, ICounter counter) throws java.io.IOException
Creates a 'counter' element.- Parameters:
counterEntity- entity of this countercounter- counter object to write out- Throws:
java.io.IOException- in case of problems with the underlying output
-
-