Class ProfileMerge
This is the engine behind config profiles (<name>-<profile>.cfg/.yml overlays activated via
juneau.profiles.active). The base config is the foundation; each active profile's entries are layered on
top in activation order so that:
- profile wins over base for any section/key the profile redefines, and
- last-active-profile wins when multiple active profiles redefine the same section/key.
Each input (base + profiles) is parsed through its own ConfigFormat (so a YAML profile is converted to the
internal INI form like any other config), then the parsed maps are overlaid entry-by-entry and re-emitted as a
single internal-INI string via ConfigMap.asIniString(). Feeding that merged string back through the normal
ConfigMap parse keeps format handling, variable resolution, and change-listener wiring identical to a
single-file config — profiles are transparent to everything downstream of the store.
- Since:
- 10.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stringmerge(ConfigStore store, String baseName, String baseContents, List<String> profiles, ConfigFormat format) Merges base + profile contents into one internal-INI string (profile-wins, last-active-profile-wins).
-
Method Details
-
merge
public static String merge(ConfigStore store, String baseName, String baseContents, List<String> profiles, ConfigFormat format) throws IOException Merges base + profile contents into one internal-INI string (profile-wins, last-active-profile-wins).- Parameters:
store- The store the throwaway parse maps are associated with (used only for parse context; never written).baseName- The base config name (for parse diagnostics).baseContents- The raw base config contents (format-native).
Can benull (treated as empty contents).profiles- Ordered profile overlays (activation order); each is a raw format-native contents string.
May be empty, but must not benull .format- The config format used to parse every input.
Can benull (defaults toIniConfigFormat).- Returns:
- The merged contents as an internal-INI string.
- Throws:
IOException- If any input fails to parse.
-