lang
lang/java/pipeline-style/index.md
medium
lang-java-pipeline-style-index
Java 业务方法的「注释驱动流水线编排」风格 — 方法即编排器 / 逻辑下沉 Converter-Validator-Utils。Use when 写 Service 业务方法 / 重构臃肿方法 / 评审方法结构时。
子项索引
| 子项 | 一句话 |
|---|---|
| orchestration-method skill | Service 业务方法写成流水线编排器 — 前置校验早返回 / 每步一行中文注释一次调用 / 中间变量 final / 无嵌套 |
| extract-converter-validator skill | 防 ServiceImpl 膨胀 — 数据转换抽 Converter、参数校验抽 Validator、外部调用返回值校验下沉,编排方法每类只留一行调用 |
Pipeline Style · 注释驱动流水线编排
这是团队编码风格基准:业务方法写成"流水线编排器",每步一注释一调用,具体逻辑下沉。 本仓所有 Java Service/业务方法的代码例子都应遵循此风格。
按你正在做的事下钻:
| 你在做什么 | 进哪个 |
|---|---|
| 写一个 Service 业务方法,想知道方法体怎么组织 | orchestration-method |
| ServiceImpl 里堆了大段转换 / 校验代码,想抽出去 | extract-converter-validator |
相关
- 父:
../index.md - 分层职责(Controller 薄 / Service 编排 / Mapper 纯):
../layering/index.md - 同思想的设计模式:
../../../design-pattern/pipeline/index.md(注释驱动的 Step 编排) - 编排里用到的工具:
../collections/stream-api.md(集合用 Stream)·../../../framework/mapstruct/index.md(转换用 MapStruct)·../utils/utility-class-design.md(逻辑下沉 Utils)