Class ConfigSourceProcessor

java.lang.Object
cloud.opencode.base.config.jdk25.ConfigSourceProcessor

public class ConfigSourceProcessor extends Object
Configuration Source Processor with Pattern Matching 配置源处理器(使用模式匹配)

Demonstrates JDK 25 pattern matching for sealed types. Processes different configuration source types using exhaustive switch expressions.

演示JDK 25密封类型的模式匹配。使用完备的switch表达式处理不同的配置源类型。

Features | 主要功能:

  • Exhaustive pattern matching - 完备模式匹配
  • Record pattern deconstruction - 记录模式解构
  • Type-safe source handling - 类型安全的源处理

Usage Examples | 使用示例:

ConfigSourceProcessor processor = new ConfigSourceProcessor();

// Process file source
processor.process(new ConfigSourceType.File(Path.of("app.properties")));

// Process environment source
processor.process(new ConfigSourceType.Environment("APP"));

// Process system properties
processor.process(new ConfigSourceType.System());

JDK 25 Features Used | 使用的JDK 25特性:

  • Pattern matching for switch - switch模式匹配
  • Record patterns - 记录模式
  • Sealed type exhaustiveness - 密封类型完备性

Security | 安全性:

  • Thread-safe: Yes - 线程安全: 是
  • Null-safe: Partial (validates inputs) - 空值安全: 部分(验证输入)

Performance | 性能特性:

  • Time complexity: O(1) per call - exhaustive switch dispatch - 时间复杂度: 每次调用 O(1),完备 switch 分发
  • Space complexity: O(1) - 空间复杂度: O(1)
Since:
JDK 25, opencode-base-config V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • ConfigSourceProcessor

      public ConfigSourceProcessor()
  • Method Details