Package com.streamconverter.command
Class LoggingDecorator
java.lang.Object
com.streamconverter.command.LoggingDecorator
- All Implemented Interfaces:
IStreamCommand
IStreamCommandのログ出力デコレーター
このクラスは既存のIStreamCommandをラップして、詳細なログ出力機能を追加します。 デコレーターパターンを使用することで、既存のコマンドを変更せずに 追加のログ機能を提供できます。
使用例:
IStreamCommand originalCommand = new CsvNavigateCommand("name"); IStreamCommand loggedCommand = new LoggingDecorator(originalCommand); loggedCommand.execute(inputStream, outputStream);
-
Constructor Summary
ConstructorsConstructorDescriptionLoggingDecorator
(IStreamCommand delegate) コンストラクタLoggingDecorator
(IStreamCommand delegate, String loggerName) カスタムログ名を指定するコンストラクタ -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute
(InputStream inputStream, OutputStream outputStream) 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, wait
Methods inherited from interface com.streamconverter.command.IStreamCommand
execute
-
Constructor Details
-
LoggingDecorator
コンストラクタ- Parameters:
delegate
- ラップ対象のコマンド
-
LoggingDecorator
カスタムログ名を指定するコンストラクタ- Parameters:
delegate
- ラップ対象のコマンドloggerName
- ログ名
-
-
Method Details
-
execute
Description copied from interface:IStreamCommand
Executes the command on the provided input stream and writes the result to the output stream.This method maintains backward compatibility for existing implementations. When called without ExecutionContext, a new context will be automatically created by the StreamConverter pipeline.
- Specified by:
execute
in interfaceIStreamCommand
- Parameters:
inputStream
- The input stream to read data from.outputStream
- The output stream to write data to.- Throws:
IOException
- If an I/O error occurs during the execution of the command.
-
getDelegate
ラップされているコマンドを取得- Returns:
- ラップされているコマンド
-
getCommandName
コマンド名を取得- Returns:
- コマンド名
-