aboutsummaryrefslogtreecommitdiffstats
path: root/config-lib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-01-08 23:11:07 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-01-08 23:11:07 +0000
commitd754f49feab71a748bc2392a465177e5c5ed987d (patch)
treebc40dad254cc88394bb7b6f94d3f5995612b286d /config-lib
parent369e74eee7540c7a4745361d49dc4494ee76058f (diff)
Add some comments.
Diffstat (limited to 'config-lib')
-rw-r--r--config-lib/src/main/java/com/yahoo/config/InnerNode.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/config-lib/src/main/java/com/yahoo/config/InnerNode.java b/config-lib/src/main/java/com/yahoo/config/InnerNode.java
index 94afe64b667..45f61fee315 100644
--- a/config-lib/src/main/java/com/yahoo/config/InnerNode.java
+++ b/config-lib/src/main/java/com/yahoo/config/InnerNode.java
@@ -64,6 +64,8 @@ public abstract class InnerNode extends Node {
if ( !(other instanceof InnerNode) || (other.getClass() != this.getClass()))
return false;
+ /* This implementation requires getChildren() to return elements in order.
+ Hence we should make it final. Or make equals independent of order. */
Collection<Object> children = getChildren().values();
Collection<Object> otherChildren = ((InnerNode)other).getChildren().values();
@@ -86,8 +88,9 @@ public abstract class InnerNode extends Node {
return res;
}
+ // TODO Make final before Vespa 8 as correct order is required
protected Map<String, Object> getChildren() {
- HashMap<String, Object> ret = new LinkedHashMap<String, Object>();
+ HashMap<String, Object> ret = new LinkedHashMap<>();
Field fields[] = getClass().getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
@@ -108,10 +111,11 @@ public abstract class InnerNode extends Node {
/**
* Returns a flat map of this node's direct children, including all NodeVectors' elements.
* Keys are the node name, including index for vector elements, e.g. 'arr[0]'.
+ * TODO Make final before Vespa 8 as correct order is required
*/
@SuppressWarnings("unchecked")
protected Map<String, Node> getChildrenWithVectorsFlattened() {
- HashMap<String, Node> ret = new LinkedHashMap<String, Node>();
+ HashMap<String, Node> ret = new LinkedHashMap<>();
Map<String, Object> children = getChildren();
for (Map.Entry<String, Object> childEntry : children.entrySet()) {
@@ -151,7 +155,7 @@ public abstract class InnerNode extends Node {
* @return map of leaf nodes
*/
private static Map<String, LeafNode<?>> getAllDescendantLeafNodes(String parentName, InnerNode node) {
- Map<String, LeafNode<?>> ret = new LinkedHashMap<String, LeafNode<?>>();
+ Map<String, LeafNode<?>> ret = new LinkedHashMap<>();
String prefix = parentName.isEmpty() ? "" : parentName + ".";
Map<String, Node> children = node.getChildrenWithVectorsFlattened();
for (Map.Entry<String, Node> childEntry : children.entrySet()) {