Class JsonNavigateCommand

java.lang.Object
com.streamconverter.command.AbstractStreamCommand
com.streamconverter.command.impl.json.JsonNavigateCommand
All Implemented Interfaces:
IStreamCommand

JSON Navigation Command for applying transformations to JSON data

This command navigates through JSON structures and applies transformations using rules while preserving the overall JSON structure. It focuses purely on navigation and transformation, not extraction.

Responsibilities: - Navigate to specified JSON paths - Apply transformation rules to matching elements - Preserve JSON structure during transformation - Stream processing for memory efficiency

  • Constructor Details

    • JsonNavigateCommand

      public JsonNavigateCommand(TreePath treePath, IRule rule)
      Constructor for JSON navigation with TreePath selector and transformation rule.
      Parameters:
      treePath - the TreePath to select data
      rule - the transformation rule to apply to selected elements
      Throws:
      IllegalArgumentException - if treePath or rule is null
  • Method Details

    • create

      public static JsonNavigateCommand create(TreePath treePath, IRule rule)
      Factory method for creating a JSON navigation command with TreePath and rule.
      Parameters:
      treePath - the TreePath to select data
      rule - the transformation rule to apply to selected elements
      Returns:
      a JsonNavigateCommand that transforms the specified path with the given rule
      Throws:
      IllegalArgumentException - if rule is null
    • getCommandDetails

      Description copied from class: AbstractStreamCommand
      コマンドの詳細情報を取得します。

      サブクラスでオーバーライドして、コマンド固有の設定や状態を返すことができます。 この情報はデバッグログに出力され、問題の診断に役立ちます。

      Overrides:
      getCommandDetails in class AbstractStreamCommand
      Returns:
      コマンドの詳細情報
    • executeInternal

      protected void executeInternal(InputStream inputStream, OutputStream outputStream) throws IOException
      Description copied from class: AbstractStreamCommand
      Abstract method to be implemented by subclasses for executing the command.
      Specified by:
      executeInternal in class AbstractStreamCommand
      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.