Support flag for replacing an array when overriding config, part 1
@@ -275,6 +275,8 @@ public class ConfigPayloadBuilder {
public class Array {
private final Map<Integer, ConfigPayloadBuilder> elements = new LinkedHashMap<>();
private ArrayMode mode = ArrayMode.INDEX;
+ // If true, this array should completely replace parent array when config override resolving is done
+ private boolean overrideWillReplace = false;
private final String name;
private final ConfigDefinition configDefinition;
@@ -386,6 +388,14 @@ public class ConfigPayloadBuilder {
mode = ArrayMode.APPEND;
}
+ public void replaceWhenOverriding(boolean overrideWillReplace) {
+ this.overrideWillReplace = overrideWillReplace;
+ }
+
+ public boolean replaceWhenOverriding() {
+ return overrideWillReplace;
+ }
+
/**
* Try and verify that index mode is possible.
*/
