sergey-chugunov-1985 commented on a change in pull request #67:
URL: https://github.com/apache/ignite-3/pull/67#discussion_r596759514



##########
File path: 
modules/configuration/src/main/java/org/apache/ignite/configuration/internal/util/KeysTrackingConfigurationVisitor.java
##########
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.configuration.internal.util;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.function.Supplier;
+import org.apache.ignite.configuration.tree.ConfigurationVisitor;
+import org.apache.ignite.configuration.tree.InnerNode;
+import org.apache.ignite.configuration.tree.NamedListNode;
+
+/** Visitor that accumulates keys while descending. */
+public abstract class KeysTrackingConfigurationVisitor<T> implements 
ConfigurationVisitor<T> {
+    /** Current key, aggregated by visitor. */
+    private StringBuilder currentKey = new StringBuilder();
+
+    /** Current keys list, almost the same as {@link #currentKey}. */
+    private List<String> currentPath = new ArrayList<>();
+
+    /** {@inheritDoc} */
+    @Override public final T visitLeafNode(String key, Serializable val) {
+        int prevPos = startVisit(key, false, true);
+
+        try {
+            return visitLeafNode0(key, val);
+        }
+        finally {
+            endVisit(prevPos);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public final T visitInnerNode(String key, InnerNode node) {
+        int prevPos = startVisit(key, false, false);
+
+        try {
+            return visitInnerNode0(key, node);
+        }
+        finally {
+            endVisit(prevPos);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public final <N extends InnerNode> T visitNamedListNode(String 
key, NamedListNode<N> node) {
+        int prevPos = startVisit(key, false, false);
+
+        try {
+            return visitNamedListNode0(key, node);
+        }
+        finally {
+            endVisit(prevPos);
+        }
+    }
+
+    /** To be used instead of {@link 
ConfigurationVisitor#visitLeafNode(String, Serializable)}. */
+    protected T visitLeafNode0(String key, Serializable val) {

Review comment:
       I don't like our naming conventions with this "number-suffix" rule. What 
do you think about `doVisitLeaf` name?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to