Class YamlMerger
java.lang.Object
com.pragma.archetype.domain.service.YamlMerger
Service for intelligently merging YAML configurations.
Preserves existing values and only adds new properties.
Detects conflicts when the same key exists with different values.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionPerforms deep merge of nested map structures.booleanChecks if merging overlay into base would cause a conflict for the given key.Merges overlay map into base map, preserving existing values.
-
Constructor Details
-
YamlMerger
public YamlMerger()
-
-
Method Details
-
merge
Merges overlay map into base map, preserving existing values. Only adds properties that don't already exist in the base.- Parameters:
base- The existing configuration mapoverlay- The new properties to merge- Returns:
- MergeResult containing merged data, conflicts, and added keys
-
deepMerge
Performs deep merge of nested map structures. Recursively merges nested maps while preserving existing values.- Parameters:
base- The base map to merge intooverlay- The overlay map to merge from- Returns:
- The merged map
-
hasConflict
Checks if merging overlay into base would cause a conflict for the given key. A conflict occurs when the key exists in both maps with different values.- Parameters:
base- The base mapoverlay- The overlay mapkey- The key to check- Returns:
- true if there would be a conflict, false otherwise
-