Interface ResultCustomizer
public interface ResultCustomizer
Result Customizer SPI
响应定制器SPI
Service Provider Interface for customizing results before returning.
在返回之前定制响应的服务提供者接口。
Usage | 使用方式:
public class TraceIdCustomizer implements ResultCustomizer {
@Override
public <T> Result<T> customize(Result<T> result) {
// Add trace ID to result
return result;
}
}
Features | 主要功能:
- SPI for result customization - 响应定制SPI
- Conditional application support - 条件应用支持
- Priority ordering support - 优先级排序支持
Usage Examples | 使用示例:
public class AuditCustomizer implements ResultCustomizer {
public <T> Result<T> customize(Result<T> result) {
return result.withTraceId(generateTraceId());
}
}
Security | 安全性:
- Thread-safe: Implementation-dependent - 取决于实现
- Null-safe: No (result should not be null) - 否(结果不应为null)
- Since:
- JDK 25, opencode-base-web V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
-
Method Details
-
customize
-
getOrder
default int getOrder()Get the customizer order 获取定制器顺序Lower values execute first.
值越小越先执行。
- Returns:
- the order | 顺序
-
shouldApply
Check if should apply to this result 检查是否应用于此响应- Parameters:
result- the result to check | 要检查的响应- Returns:
- true if should apply | 如果应该应用返回true
-