org.jacoco.report.internal.xml
Class ReportElement

java.lang.Object
  extended by org.jacoco.report.internal.xml.XMLElement
      extended by org.jacoco.report.internal.xml.ReportElement

public class ReportElement
extends XMLElement

A XMLElement with utility methods to create JaCoCo XML reports.


Field Summary
 
Fields inherited from class org.jacoco.report.internal.xml.XMLElement
writer
 
Constructor Summary
ReportElement(String name, OutputStream output, String encoding)
          Creates a report root element for a XML report.
 
Method Summary
 ReportElement classElement(org.jacoco.core.analysis.IClassCoverage coverage)
          Creates a 'class' element.
 void counter(org.jacoco.core.analysis.ICoverageNode.CounterEntity counterEntity, org.jacoco.core.analysis.ICounter counter)
          Creates a 'counter' element.
 ReportElement element(String name)
          Creates a new child element for this element.
 ReportElement group(String name)
          Creates a 'group' element.
 void line(int nr, org.jacoco.core.analysis.ILine line)
          Creates a 'line' element.
 ReportElement method(org.jacoco.core.analysis.IMethodCoverage coverage)
          Creates a 'method' element.
 ReportElement packageElement(String name)
          Creates a 'package' element.
 void sessioninfo(org.jacoco.core.data.SessionInfo info)
          Creates a 'sessioninfo' element.
 ReportElement sourcefile(String name)
          Creates a 'sourcefile' element.
 
Methods inherited from class org.jacoco.report.internal.xml.XMLElement
attr, attr, attr, close, text
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReportElement

public ReportElement(String name,
                     OutputStream output,
                     String encoding)
              throws IOException
Creates a report root element for a XML report.

Parameters:
name - value for the name attribute
encoding - character encoding used for output
output - output stream will be closed if the root element is closed
Throws:
IOException - in case of problems with the underlying output
Method Detail

element

public ReportElement element(String name)
                      throws IOException
Description copied from class: XMLElement
Creates a new child element for this element. Might be overridden in subclasses to return a instance of the subclass.

Overrides:
element in class XMLElement
Parameters:
name - name of the child element
Returns:
child element instance
Throws:
IOException - in case of problems with the underlying output

sessioninfo

public void sessioninfo(org.jacoco.core.data.SessionInfo info)
                 throws IOException
Creates a 'sessioninfo' element.

Parameters:
info - info object to write out
Throws:
IOException - in case of problems with the underlying output

group

public ReportElement group(String name)
                    throws IOException
Creates a 'group' element.

Parameters:
name - value for the name attribute
Returns:
'group' element
Throws:
IOException - in case of problems with the underlying output

packageElement

public ReportElement packageElement(String name)
                             throws IOException
Creates a 'package' element.

Parameters:
name - value for the name attribute
Returns:
'package' element
Throws:
IOException - in case of problems with the underlying output

classElement

public ReportElement classElement(org.jacoco.core.analysis.IClassCoverage coverage)
                           throws IOException
Creates a 'class' element.

Parameters:
coverage - class coverage node to write out
Returns:
'class' element
Throws:
IOException - in case of problems with the underlying output

method

public ReportElement method(org.jacoco.core.analysis.IMethodCoverage coverage)
                     throws IOException
Creates a 'method' element.

Parameters:
coverage - method coverage node to write out
Returns:
'method' element
Throws:
IOException - in case of problems with the underlying output

sourcefile

public ReportElement sourcefile(String name)
                         throws IOException
Creates a 'sourcefile' element.

Parameters:
name - value for the name attribute
Returns:
'sourcefile' element
Throws:
IOException - in case of problems with the underlying output

line

public void line(int nr,
                 org.jacoco.core.analysis.ILine line)
          throws IOException
Creates a 'line' element.

Parameters:
nr - line number
line - line object to write out
Throws:
IOException - in case of problems with the underlying output

counter

public void counter(org.jacoco.core.analysis.ICoverageNode.CounterEntity counterEntity,
                    org.jacoco.core.analysis.ICounter counter)
             throws IOException
Creates a 'counter' element.

Parameters:
counterEntity - entity of this counter
counter - counter object to write out
Throws:
IOException - in case of problems with the underlying output


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