Class CsvNavigateCommand

java.lang.Object
com.streamconverter.command.AbstractStreamCommand
com.streamconverter.command.impl.csv.CsvNavigateCommand
All Implemented Interfaces:
IStreamCommand

CSV Navigate Command Class

This class implements command for targeted CSV transformation using column selectors. It identifies specific columns using column names or indices and applies IRule transformations to those columns while preserving the overall CSV structure.

  • Constructor Details

    • CsvNavigateCommand

      @Deprecated public CsvNavigateCommand(String columnSelector, IRule rule)
      Deprecated.
      Constructor for CSV navigation with column selector and transformation rule.
      Parameters:
      columnSelector - the column name or index to select (e.g., "name", "2")
      rule - the transformation rule to apply to selected column
      Throws:
      IllegalArgumentException - if columnSelector or rule is null
    • CsvNavigateCommand

      public CsvNavigateCommand(CSVPath columnSelector, IRule rule)
      Constructor for CSV navigation with typed column selector and transformation rule.
      Parameters:
      columnSelector - the typed CSVPath to select column
      rule - the transformation rule to apply to selected column
      Throws:
      IllegalArgumentException - if columnSelector or rule is null
    • CsvNavigateCommand

      public CsvNavigateCommand(TreePath treePath, IRule rule)
      Constructor for CSV navigation with TreePath (for compatibility).
      Parameters:
      treePath - the TreePath representing column selector
      rule - the transformation rule to apply to selected column
      Throws:
      IllegalArgumentException - if treePath or rule is null
  • Method Details

    • create

      @Deprecated public static CsvNavigateCommand create(String columnSelector, IRule rule)
      Deprecated.
      Factory method for creating a CSV navigation command with explicit rule specification. This method makes the intention explicit: extract data from the specified column and apply the given transformation rule.
      Parameters:
      columnSelector - the column name or index to select (e.g., "name", "2")
      rule - the transformation rule to apply to selected column data
      Returns:
      a CsvNavigateCommand that extracts the specified column with the given rule
      Throws:
      IllegalArgumentException - if rule is null
    • create

      public static CsvNavigateCommand create(CSVPath columnSelector, IRule rule)
      Factory method for creating a CSV navigation command with typed column selector and rule.
      Parameters:
      columnSelector - the typed CSVPath to select column
      rule - the transformation rule to apply to selected column data
      Returns:
      a CsvNavigateCommand that extracts the specified column 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.