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
AXMLElement
with utility methods to create JaCoCo XML reports.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
PUBID
private static java.lang.String
SYSTEM
-
Fields inherited from class org.jacoco.report.internal.xml.XMLElement
writer
-
-
Constructor Summary
Constructors Modifier Constructor Description ReportElement(java.lang.String name, java.io.OutputStream output, java.lang.String encoding)
Creates areport
root element for a XML report.private
ReportElement(java.lang.String name, ReportElement parent)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ReportElement
classElement(IClassCoverage coverage)
Creates a 'class' element.void
counter(ICoverageNode.CounterEntity counterEntity, ICounter counter)
Creates a 'counter' element.private static void
counterAttributes(XMLElement element, java.lang.String missedattr, java.lang.String coveredattr, ICounter counter)
ReportElement
element(java.lang.String name)
Creates a new child element for this element.ReportElement
group(java.lang.String name)
Creates a 'group' element.void
line(int nr, ILine line)
Creates a 'line' element.ReportElement
method(IMethodCoverage coverage)
Creates a 'method' element.private ReportElement
namedElement(java.lang.String elementName, java.lang.String name)
ReportElement
packageElement(java.lang.String name)
Creates a 'package' element.void
sessioninfo(SessionInfo info)
Creates a 'sessioninfo' element.ReportElement
sourcefile(java.lang.String name)
Creates a 'sourcefile' element.
-
-
-
Field Detail
-
PUBID
private static final java.lang.String PUBID
- See Also:
- Constant Field Values
-
SYSTEM
private static final java.lang.String SYSTEM
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ReportElement
public ReportElement(java.lang.String name, java.io.OutputStream output, java.lang.String encoding) throws java.io.IOException
Creates areport
root 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
-
ReportElement
private ReportElement(java.lang.String name, ReportElement parent) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
element
public ReportElement element(java.lang.String name) throws java.io.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 classXMLElement
- Parameters:
name
- name of the child element- Returns:
- child element instance
- Throws:
java.io.IOException
- in case of problems with the underlying output
-
namedElement
private ReportElement namedElement(java.lang.String elementName, java.lang.String name) throws java.io.IOException
- Throws:
java.io.IOException
-
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.IOException
Creates 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
-
counterAttributes
private static void counterAttributes(XMLElement element, java.lang.String missedattr, java.lang.String coveredattr, ICounter counter) throws java.io.IOException
- Throws:
java.io.IOException
-
-