Enum Class MergeStrategy
- All Implemented Interfaces:
Serializable, Comparable<MergeStrategy>, Constable
Merge Strategy - Defines how YAML documents are merged
合并策略 - 定义 YAML 文档如何合并
This enum defines different strategies for merging YAML documents.
此枚举定义了合并 YAML 文档的不同策略。
Features | 主要功能:
- Override, keep-first, deep merge, list append, unique merge, and fail-on-conflict - 覆盖、保留首个、深度合并、列表追加、唯一合并和冲突失败
Usage Examples | 使用示例:
Map<String, Object> merged = YmlMerger.merge(base, overlay, MergeStrategy.DEEP_MERGE);
Security | 安全性:
- Thread-safe: Yes (enum constants are immutable) - 线程安全: 是(枚举常量不可变)
- Null-safe: N/A - 空值安全: 不适用
- Since:
- JDK 25, opencode-base-yml V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAppend lists instead of replacing 追加列表而不是替换Deep merge maps recursively 递归深度合并映射Fail on conflict 冲突时失败Keep first value (earlier wins) 保留第一个值(先者优先)Merge lists by removing duplicates 通过去重合并列表Override values (later wins) 覆盖值(后者优先) -
Method Summary
Modifier and TypeMethodDescriptionstatic MergeStrategyReturns the enum constant of this class with the specified name.static MergeStrategy[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
OVERRIDE
Override values (later wins) 覆盖值(后者优先) -
KEEP_FIRST
Keep first value (earlier wins) 保留第一个值(先者优先) -
DEEP_MERGE
Deep merge maps recursively 递归深度合并映射 -
APPEND_LISTS
Append lists instead of replacing 追加列表而不是替换 -
MERGE_LISTS_UNIQUE
Merge lists by removing duplicates 通过去重合并列表 -
FAIL_ON_CONFLICT
Fail on conflict 冲突时失败
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-