aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src
diff options
context:
space:
mode:
authorArne Juul <arnej@yahooinc.com>2023-02-14 10:37:07 +0000
committerArne Juul <arnej@yahooinc.com>2023-02-14 10:54:02 +0000
commitd72297682184050e8d93a6064f86ff6d1044d212 (patch)
treecad5f283545e4e5268fe9584af04c458c9d9c313 /config-model/src
parent90ffec36510f64a4b6ec1abf584682e1808468cf (diff)
simple default for dump() and getChildren()
Diffstat (limited to 'config-model/src')
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/producer/TreeConfigProducer.java9
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/ConfigProducer.java13
2 files changed, 10 insertions, 12 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/producer/TreeConfigProducer.java b/config-model/src/main/java/com/yahoo/config/model/producer/TreeConfigProducer.java
index d7cabaa54be..012bffaf7f6 100644
--- a/config-model/src/main/java/com/yahoo/config/model/producer/TreeConfigProducer.java
+++ b/config-model/src/main/java/com/yahoo/config/model/producer/TreeConfigProducer.java
@@ -124,15 +124,6 @@ public abstract class TreeConfigProducer<CHILD extends AnyConfigProducer>
protected void addDescendantService(Service s) { descendantServices.add(s); }
- public void dump(PrintStream out) {
- for (ConfigProducer c : getChildren().values()) {
- out.println("id: " + c.getConfigId());
- if (c.getChildren().size() > 0) {
- c.dump(out);
- }
- }
- }
-
void setupConfigId(String parentConfigId) {
super.setupConfigId(parentConfigId);
setupChildConfigIds(getConfigIdPrefix());
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/ConfigProducer.java b/config-model/src/main/java/com/yahoo/vespa/model/ConfigProducer.java
index b7719e3ab11..3f207102046 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/ConfigProducer.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/ConfigProducer.java
@@ -27,17 +27,24 @@ public interface ConfigProducer extends com.yahoo.config.ConfigInstance.Producer
UserConfigRepo getUserConfigs();
/** Returns this ConfigProducer's children (only 1st level) */
- Map<String,? extends ConfigProducer> getChildren();
+ default Map<String,? extends ConfigProducer> getChildren() { return Map.of(); }
/** Returns a List of all Services that are descendants to this ConfigProducer */
List<Service> getDescendantServices();
/**
- * Dump the three of config producers to the specified stream.
+ * Dump the tree of config producers to the specified stream.
*
* @param out The stream to print to, e.g. System.out
*/
- void dump(PrintStream out);
+ default void dump(PrintStream out) {
+ for (ConfigProducer c : getChildren().values()) {
+ out.println("id: " + c.getConfigId());
+ if (c.getChildren().size() > 0) {
+ c.dump(out);
+ }
+ }
+ }
/**
* Build config from this and all parent ConfigProducers,