From b0a22e85414e1ba7b115cf374c98f76c9f21e932 Mon Sep 17 00:00:00 2001 From: Luck Date: Sat, 4 Jun 2022 20:26:36 +0100 Subject: Filter more level seed properties from configs --- .../platform/serverconfig/AbstractServerConfigProvider.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'spark-common/src/main/java/me/lucko') diff --git a/spark-common/src/main/java/me/lucko/spark/common/platform/serverconfig/AbstractServerConfigProvider.java b/spark-common/src/main/java/me/lucko/spark/common/platform/serverconfig/AbstractServerConfigProvider.java index 56b3731..ead2131 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/platform/serverconfig/AbstractServerConfigProvider.java +++ b/spark-common/src/main/java/me/lucko/spark/common/platform/serverconfig/AbstractServerConfigProvider.java @@ -108,6 +108,12 @@ public abstract class AbstractServerConfigProvider> implements keys = jsonObject.entrySet().stream() .map(Map.Entry::getKey) .collect(Collectors.toList()); + } else if (expected.endsWith("*")) { + String pattern = expected.substring(0, expected.length() - 1); + keys = jsonObject.entrySet().stream() + .map(Map.Entry::getKey) + .filter(key -> key.startsWith(pattern)) + .collect(Collectors.toList()); } else if (jsonObject.has(expected)) { keys = Collections.singletonList(expected); } else { @@ -118,7 +124,7 @@ public abstract class AbstractServerConfigProvider> implements if (path.isEmpty()) { jsonObject.remove(key); } else { - Deque pathCopy = expected.equals("*") + Deque pathCopy = keys.size() > 1 ? new LinkedList<>(path) : path; -- cgit