Package cloud.opencode.base.functional.pipeline
package cloud.opencode.base.functional.pipeline
Pipeline - Composable data transformation pipelines
管道 - 可组合的数据转换管道
Provides a fluent API for building reusable data transformation pipelines with support for validation, logging, and parallel execution.
提供构建可复用数据转换管道的流式 API,支持验证、日志和并行执行。
Features | 主要功能:
Usage Examples | 使用示例:
// Create a reusable pipeline
Pipeline<String, User> userPipeline = Pipeline.<String>start()
.then(String::trim)
.peek(s -> log.debug("Processing: {}", s))
.thenTry(this::parseJson)
.then(this::mapToUser);
// Execute
User user = userPipeline.execute(jsonString);
// Batch execute with Virtual Threads
List<User> users = userPipeline.executeBatch(jsonStrings);
// Async execution
CompletableFuture<User> future = userPipeline.executeAsync(jsonString);
vs Stream API | 与 Stream API 的区别:
- Pipeline: Reusable, single-value focused - 可复用,单值导向
- Stream: One-time, collection focused - 一次性,集合导向
- Since:
- JDK 25, opencode-base-functional V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
ClassesClassDescriptionPipeline<T,
R> Pipeline - Composable data transformation pipeline Pipeline - 可组合的数据转换管道CollectionPipeline - Pipeline for processing collections CollectionPipeline - 用于处理集合的管道PipelineBuilder - Fluent builder for single-value pipelines PipelineBuilder - 单值管道的流式构建器TryPipelineBuilder - Builder for pipelines that may fail TryPipelineBuilder - 可能失败的管道构建器PipeUtil - Utility methods for pipeline operations PipeUtil - 管道操作的工具方法Pipe - Value holder for pipe operations Pipe - 管道操作的值持有者