diff options
author | Luck <git@lucko.me> | 2022-06-04 20:26:36 +0100 |
---|---|---|
committer | Luck <git@lucko.me> | 2022-06-04 20:26:44 +0100 |
commit | b0a22e85414e1ba7b115cf374c98f76c9f21e932 (patch) | |
tree | 8d0637974164c1c6cd88c24ede63f998284db5a0 /spark-common/src/main/java/me/lucko | |
parent | d3e6d73b6be762558a3c7ff991ba52d4d6cfb74d (diff) | |
download | spark-b0a22e85414e1ba7b115cf374c98f76c9f21e932.tar.gz spark-b0a22e85414e1ba7b115cf374c98f76c9f21e932.tar.bz2 spark-b0a22e85414e1ba7b115cf374c98f76c9f21e932.zip |
Filter more level seed properties from configs
Diffstat (limited to 'spark-common/src/main/java/me/lucko')
-rw-r--r-- | spark-common/src/main/java/me/lucko/spark/common/platform/serverconfig/AbstractServerConfigProvider.java | 8 |
1 files changed, 7 insertions, 1 deletions
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<T extends Enum<T>> 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<T extends Enum<T>> implements if (path.isEmpty()) { jsonObject.remove(key); } else { - Deque<String> pathCopy = expected.equals("*") + Deque<String> pathCopy = keys.size() > 1 ? new LinkedList<>(path) : path; |