Package com.streamconverter.controller
Class CsvProcessingController
java.lang.Object
com.streamconverter.controller.AbstractStreamController
com.streamconverter.controller.CsvProcessingController
- All Implemented Interfaces:
IStreamController
Controller for CSV data processing operations.
This controller demonstrates how to configure command pipelines for CSV processing. It provides several processing modes:
- Column extraction - Extract specific columns by name or index
- Row filtering - Filter rows based on criteria
- Data transformation - Transform CSV data with additional processing
- Validation - Validate CSV structure and content
Usage examples:
// Extract specific column CsvProcessingController controller = CsvProcessingController.forColumnExtraction("name"); controller.process(inputStream, outputStream); // Complex processing pipeline CsvProcessingController controller = CsvProcessingController.forComplexProcessing("data", "processor-id"); controller.process(inputStream, outputStream);
- Since:
- 1.0
- Version:
- 1.0
- Author:
- StreamConverter Team
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Processing mode enumeration -
Method Summary
Modifier and TypeMethodDescriptionprotected CommandConfig[]
Configures the command pipeline based on the processing mode.static CsvProcessingController
forColumnExtraction
(String columnSelector) Factory method for creating a column extraction controller.static CsvProcessingController
forComplexProcessing
(String columnSelector, String processorId) Factory method for creating a complex processing controller.static CsvProcessingController
Factory method for creating a pass-through controller.Gets the column selector if applicable.Gets a description of the controller's current configuration.Gets the expected input data type that this controller can handle.Gets the output data type that this controller produces.Gets the processing mode of this controller.Gets the processor ID if applicable.Methods inherited from class com.streamconverter.controller.AbstractStreamController
getCommandConfigs, getStreamConverter, isConfigured, process, validateConfiguration
-
Method Details
-
forColumnExtraction
Factory method for creating a column extraction controller.- Parameters:
columnSelector
- column name or index to extract- Returns:
- configured controller
-
forComplexProcessing
public static CsvProcessingController forComplexProcessing(String columnSelector, String processorId) Factory method for creating a complex processing controller.- Parameters:
columnSelector
- column name or index to extractprocessorId
- processor ID for additional processing- Returns:
- configured controller
-
forPassThrough
Factory method for creating a pass-through controller.- Returns:
- configured controller that processes CSV without extraction
-
configureCommands
Configures the command pipeline based on the processing mode.- Specified by:
configureCommands
in classAbstractStreamController
- Returns:
- array of command configurations
-
getInputDataType
Description copied from interface:IStreamController
Gets the expected input data type that this controller can handle.This information can be used by external systems to route data to appropriate controllers.
- Returns:
- the expected input data type (e.g., "CSV", "JSON", "XML", "BINARY")
-
getOutputDataType
Description copied from interface:IStreamController
Gets the output data type that this controller produces.This information helps external systems understand what type of data to expect from the processing.
- Returns:
- the output data type (e.g., "CSV", "JSON", "XML", "BINARY")
-
getProcessingMode
Gets the processing mode of this controller.- Returns:
- the processing mode
-
getColumnSelector
Gets the column selector if applicable.- Returns:
- the column selector, or null if not applicable
-
getProcessorId
Gets the processor ID if applicable.- Returns:
- the processor ID, or null if not applicable
-
getConfigurationDescription
Description copied from class:AbstractStreamController
Gets a description of the controller's current configuration.- Specified by:
getConfigurationDescription
in interfaceIStreamController
- Overrides:
getConfigurationDescription
in classAbstractStreamController
- Returns:
- configuration description
-