You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2025/02/24 15:23:50 UTC
(shardingsphere) branch master updated: Refactor NamedDatabaseRuleItemNode (#34781)
This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 24549c1dc94 Refactor NamedDatabaseRuleItemNode (#34781)
24549c1dc94 is described below
commit 24549c1dc942f48757a5bee81e29aadd671d7022
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Mon Feb 24 23:23:43 2025 +0800
Refactor NamedDatabaseRuleItemNode (#34781)
* Refactor DatabaseRuleItem
* Refactor NamedDatabaseRuleItemNode
---
.../metadata/changed/executor/type/RuleItemDroppedBuildExecutor.java | 2 +-
.../node/path/type/config/database/item/NamedDatabaseRuleItemNode.java | 3 ---
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/changed/executor/type/RuleItemDroppedBuildExecutor.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/changed/executor/type/RuleItemDroppedBuildExecutor.java
index 3cfd72f84c9..48ee0224a25 100644
--- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/changed/executor/type/RuleItemDroppedBuildExecutor.java
+++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/changed/executor/type/RuleItemDroppedBuildExecutor.java
@@ -38,7 +38,7 @@ public final class RuleItemDroppedBuildExecutor implements RuleItemChangedBuildE
@Override
public Optional<DropRuleItem> build(final DatabaseRuleNode databaseRuleNode, final String databaseName, final String path, final Integer activeVersion) {
for (Entry<String, NamedDatabaseRuleItemNode> entry : databaseRuleNode.getNamedItems().entrySet()) {
- Optional<String> itemName = NodePathSearcher.find(path, DatabaseRuleNodePath.createRuleItemNameSearchCriteria(entry.getValue().getRuleType(), entry.getValue().getType()));
+ Optional<String> itemName = NodePathSearcher.find(path, DatabaseRuleNodePath.createRuleItemNameSearchCriteria(databaseRuleNode.getRuleType(), entry.getValue().getType()));
if (itemName.isPresent()) {
return Optional.of(new DropNamedRuleItem(databaseName, itemName.get(), databaseRuleNode.getRuleType() + "." + entry.getKey()));
}
diff --git a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/type/config/database/item/NamedDatabaseRuleItemNode.java b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/type/config/database/item/NamedDatabaseRuleItemNode.java
index 9608e66ca42..af43e28e6e1 100644
--- a/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/type/config/database/item/NamedDatabaseRuleItemNode.java
+++ b/mode/node/src/main/java/org/apache/shardingsphere/mode/node/path/type/config/database/item/NamedDatabaseRuleItemNode.java
@@ -30,14 +30,11 @@ import org.apache.shardingsphere.mode.node.path.type.version.VersionNodePathPars
@Getter
public final class NamedDatabaseRuleItemNode {
- private final String ruleType;
-
private final String type;
private final VersionNodePathParser versionNodePathParser;
public NamedDatabaseRuleItemNode(final String ruleType, final String type) {
- this.ruleType = ruleType;
this.type = type;
versionNodePathParser = NodePathSearcher.getVersion(new DatabaseRuleNodePath(NodePathPattern.IDENTIFIER, ruleType, new DatabaseRuleItem(type, NodePathPattern.IDENTIFIER)));
}