Class PlaceholderResolver.Builder

java.lang.Object
cloud.opencode.base.yml.placeholder.PlaceholderResolver.Builder
Enclosing class:
PlaceholderResolver

public static final class PlaceholderResolver.Builder extends Object
Placeholder Resolver Builder 占位符解析器构建器
Since:
JDK 25, opencode-base-yml V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • prefix

      public PlaceholderResolver.Builder prefix(String prefix)
      Sets the placeholder prefix. 设置占位符前缀。
      Parameters:
      prefix - the prefix (default: "${") | 前缀(默认:"${")
      Returns:
      this builder | 此构建器
    • suffix

      public PlaceholderResolver.Builder suffix(String suffix)
      Sets the placeholder suffix. 设置占位符后缀。
      Parameters:
      suffix - the suffix (default: "}") | 后缀(默认:"}")
      Returns:
      this builder | 此构建器
    • defaultValueSeparator

      public PlaceholderResolver.Builder defaultValueSeparator(String separator)
      Sets the default value separator. 设置默认值分隔符。
      Parameters:
      separator - the separator (default: ":") | 分隔符(默认:":")
      Returns:
      this builder | 此构建器
    • strict

      public PlaceholderResolver.Builder strict(boolean strict)
      Sets strict mode (throws exception for unresolved placeholders). 设置严格模式(对未解析的占位符抛出异常)。
      Parameters:
      strict - whether strict mode is enabled | 是否启用严格模式
      Returns:
      this builder | 此构建器
    • addPropertySource

      public PlaceholderResolver.Builder addPropertySource(String name, Map<String,String> source)
      Adds a property source. 添加属性源。
      Parameters:
      name - the source name | 源名称
      source - the properties | 属性
      Returns:
      this builder | 此构建器
    • addResolver

      public PlaceholderResolver.Builder addResolver(Function<String,String> resolver)
      Adds a resolver function. 添加解析函数。
      Parameters:
      resolver - the resolver function | 解析函数
      Returns:
      this builder | 此构建器
    • withSystemProperties

      public PlaceholderResolver.Builder withSystemProperties()
      Adds system properties as a property source. 添加系统属性作为属性源。
      Returns:
      this builder | 此构建器
    • withEnvironmentVariables

      public PlaceholderResolver.Builder withEnvironmentVariables()
      Adds environment variables as a property source. 添加环境变量作为属性源。
      Returns:
      this builder | 此构建器
    • build

      public PlaceholderResolver build()
      Builds the resolver. 构建解析器。
      Returns:
      the resolver | 解析器