From 80b6cbfc9c861469146318d0b3dd5f8b8b525b8a Mon Sep 17 00:00:00 2001
From: xiejun <xiejun@vci-tech.com>
Date: 星期五, 01 十一月 2024 15:11:19 +0800
Subject: [PATCH] Revert "集成获取mdm分发通用数据格式接口集成"

---
 Source/BladeX-Tool/blade-starter-mongo/src/main/java/org/springblade/core/mongo/utils/JsonNodeInfo.java |   85 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 85 insertions(+), 0 deletions(-)

diff --git a/Source/BladeX-Tool/blade-starter-mongo/src/main/java/org/springblade/core/mongo/utils/JsonNodeInfo.java b/Source/BladeX-Tool/blade-starter-mongo/src/main/java/org/springblade/core/mongo/utils/JsonNodeInfo.java
new file mode 100644
index 0000000..7d4ae04
--- /dev/null
+++ b/Source/BladeX-Tool/blade-starter-mongo/src/main/java/org/springblade/core/mongo/utils/JsonNodeInfo.java
@@ -0,0 +1,85 @@
+package org.springblade.core.mongo.utils;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import lombok.Getter;
+import org.springframework.util.Assert;
+
+import java.util.LinkedList;
+import java.util.StringJoiner;
+
+/**
+ * json tree 鑺傜偣淇℃伅
+ *
+ * @author L.cm
+ */
+public class JsonNodeInfo {
+	/**
+	 * mongo keys: class1.class2.item
+	 */
+	private volatile String nodeKeys;
+	/**
+	 * jsonPath璇硶锛�/class1/class2/item
+	 */
+	private volatile String nodePath;
+	/**
+	 * 鑺傜偣鍏崇郴
+	 */
+	@Getter
+	private final LinkedList<String> elements;
+	/**
+	 * tree 鐨� 鍙跺瓙鑺傜偣锛屾澶勪负寮曠敤
+	 */
+	@Getter
+	private final JsonNode leafNode;
+
+	public JsonNodeInfo(LinkedList<String> elements, JsonNode leafNode) {
+		Assert.notNull(elements, "elements can not be null.");
+		this.nodeKeys = null;
+		this.nodePath = null;
+		this.elements = elements;
+		this.leafNode = leafNode;
+	}
+
+	/**
+	 * 鑾峰彇 mongo db鐨� key 璇硶
+	 * @return mongo db鐨� key 璇硶
+	 */
+	public String getNodeKeys() {
+		if (nodeKeys == null) {
+			synchronized (this) {
+				if (nodeKeys == null) {
+					StringJoiner nodeKeysJoiner = new StringJoiner(".");
+					elements.forEach(nodeKeysJoiner::add);
+					nodeKeys = nodeKeysJoiner.toString();
+				}
+			}
+		}
+		return nodeKeys;
+	}
+
+	/**
+	 * 鑾峰彇 json path 璇硶璺緞
+	 * @return jsonPath 璺緞
+	 */
+	public String getNodePath() {
+		if (nodePath == null) {
+			synchronized (this) {
+				if (nodePath == null) {
+					StringJoiner nodePathJoiner = new StringJoiner("/", "/", "");
+					elements.forEach(nodePathJoiner::add);
+					nodePath = nodePathJoiner.toString();
+				}
+			}
+		}
+		return nodePath;
+	}
+
+	/**
+	 * 鑾峰彇绗竴涓厓绱�
+	 * @return element
+	 */
+	public String getFirst() {
+		return elements.getFirst();
+	}
+
+}

--
Gitblit v1.9.3