Package com.streamconverter.sloc.command
Class JacocoXmlToModuleSlocCommand
java.lang.Object
com.streamconverter.command.AbstractStreamCommand
com.streamconverter.sloc.command.JacocoXmlToModuleSlocCommand
- All Implemented Interfaces:
IStreamCommand
JaCoCo XML レポートから LINE カウンターを抽出して
ModuleSloc オブジェクトとして出力するコマンド。
ModuleXmlConcatCommand が出力する連結ストリームを入力として受け取り、 各 <report> 要素の name
属性をモジュール名として、report 直下の <counter type="LINE"> を抽出して ObjectOutputStream で ModuleSloc を書き出す。
入力ストリームは複数の <report> 要素を持つため、パース前に <jacoco-reports> ラッパーで 包んで Well-formed な
XML として扱う。ラッパー要素名は JaCoCo の仕様に依存しない独自名を使用している。 ModuleXmlConcatCommand が XML宣言・DOCTYPE宣言を
除去した上で <report> 要素だけを渡すため、ここでは宣言の除去は不要。
ラッパー要素名は JaCoCo の仕様に依存しない独自名のため、JaCoCo のルート要素名が変わっても影響を受けない。
-
Field Summary
Fields inherited from class com.streamconverter.command.AbstractStreamCommand
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(InputStream input, OutputStream output) Executes the command on the provided input stream and writes the result to the output stream.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.streamconverter.command.IStreamCommand
commandName, withLogging, withLogging
-
Constructor Details
-
JacocoXmlToModuleSlocCommand
public JacocoXmlToModuleSlocCommand()
-
-
Method Details
-
execute
Description copied from class:AbstractStreamCommandExecutes the command on the provided input stream and writes the result to the output stream.- Specified by:
executein interfaceIStreamCommand- Specified by:
executein classAbstractStreamCommand- Parameters:
input- The input stream to read data from.output- The output stream to write data to.- Throws:
IOException- If an I/O error occurs during the execution of the command.
-