Class PlaceholderResolver.Builder
java.lang.Object
cloud.opencode.base.yml.placeholder.PlaceholderResolver.Builder
- Enclosing class:
PlaceholderResolver
Placeholder Resolver Builder
占位符解析器构建器
- Since:
- JDK 25, opencode-base-yml V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Method Summary
Modifier and TypeMethodDescriptionaddPropertySource(String name, Map<String, String> source) Adds a property source.addResolver(Function<String, String> resolver) Adds a resolver function.build()Builds the resolver.defaultValueSeparator(String separator) Sets the default value separator.Sets the placeholder prefix.strict(boolean strict) Sets strict mode (throws exception for unresolved placeholders).Sets the placeholder suffix.Adds environment variables as a property source.Adds system properties as a property source.
-
Method Details
-
prefix
Sets the placeholder prefix. 设置占位符前缀。- Parameters:
prefix- the prefix (default: "${") | 前缀(默认:"${")- Returns:
- this builder | 此构建器
-
suffix
Sets the placeholder suffix. 设置占位符后缀。- Parameters:
suffix- the suffix (default: "}") | 后缀(默认:"}")- Returns:
- this builder | 此构建器
-
defaultValueSeparator
Sets the default value separator. 设置默认值分隔符。- Parameters:
separator- the separator (default: ":") | 分隔符(默认:":")- Returns:
- this builder | 此构建器
-
strict
Sets strict mode (throws exception for unresolved placeholders). 设置严格模式(对未解析的占位符抛出异常)。- Parameters:
strict- whether strict mode is enabled | 是否启用严格模式- Returns:
- this builder | 此构建器
-
addPropertySource
Adds a property source. 添加属性源。- Parameters:
name- the source name | 源名称source- the properties | 属性- Returns:
- this builder | 此构建器
-
addResolver
Adds a resolver function. 添加解析函数。- Parameters:
resolver- the resolver function | 解析函数- Returns:
- this builder | 此构建器
-
withSystemProperties
Adds system properties as a property source. 添加系统属性作为属性源。- Returns:
- this builder | 此构建器
-
withEnvironmentVariables
Adds environment variables as a property source. 添加环境变量作为属性源。- Returns:
- this builder | 此构建器
-
build
-