This is an automated email from the ASF dual-hosted git repository.

sunnianjun 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 1b5076d19e5 Refactor RepositoryTupleSwapper's impl (#31061)
1b5076d19e5 is described below

commit 1b5076d19e50e260e5da0cc157be236d70789d9e
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Apr 29 23:00:02 2024 +0800

    Refactor RepositoryTupleSwapper's impl (#31061)
    
    * Refactor RepositoryTupleSwapper's impl
    
    * Refactor RepositoryTupleSwapper's impl
---
 ...astRuleConfigurationRepositoryTupleSwapper.java |  14 +-
 ...yptRuleConfigurationRepositoryTupleSwapper.java |  35 +++--
 ...askRuleConfigurationRepositoryTupleSwapper.java |  34 +++--
 ...ingRuleConfigurationRepositoryTupleSwapper.java |  54 +++-----
 ...dowRuleConfigurationRepositoryTupleSwapper.java |  63 ++++-----
 ...ingRuleConfigurationRepositoryTupleSwapper.java | 152 ++++++++++-----------
 ...ityRuleConfigurationRepositoryTupleSwapper.java |  35 +----
 ...ockRuleConfigurationRepositoryTupleSwapper.java |  20 +--
 ...ingRuleConfigurationRepositoryTupleSwapper.java |  31 +----
 ...gleRuleConfigurationRepositoryTupleSwapper.java |  20 +--
 ...ionRuleConfigurationRepositoryTupleSwapper.java |  20 +--
 ...serRuleConfigurationRepositoryTupleSwapper.java |  25 +---
 ...torRuleConfigurationRepositoryTupleSwapper.java |  18 +--
 ...ficRuleConfigurationRepositoryTupleSwapper.java |  48 +------
 ...ionRuleConfigurationRepositoryTupleSwapper.java |  19 +--
 .../mode/spi/RepositoryTupleSwapper.java           |   3 +-
 16 files changed, 185 insertions(+), 406 deletions(-)

diff --git 
a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/swapper/BroadcastRuleConfigurationRepositoryTupleSwapper.java
 
b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/swapper/BroadcastRuleConfigurationRepositoryTupleSwapper.java
index c76c142ee4a..2ce06657763 100644
--- 
a/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/swapper/BroadcastRuleConfigurationRepositoryTupleSwapper.java
+++ 
b/features/broadcast/core/src/main/java/org/apache/shardingsphere/broadcast/yaml/swapper/BroadcastRuleConfigurationRepositoryTupleSwapper.java
@@ -23,8 +23,8 @@ import 
org.apache.shardingsphere.broadcast.metadata.nodepath.BroadcastRuleNodePa
 import 
org.apache.shardingsphere.broadcast.yaml.config.YamlBroadcastRuleConfiguration;
 import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
 import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
-import org.apache.shardingsphere.mode.spi.RepositoryTupleSwapper;
 import org.apache.shardingsphere.mode.path.RuleNodePath;
+import org.apache.shardingsphere.mode.spi.RepositoryTupleSwapper;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -37,19 +37,15 @@ import java.util.stream.Collectors;
  */
 public final class BroadcastRuleConfigurationRepositoryTupleSwapper implements 
RepositoryTupleSwapper<BroadcastRuleConfiguration> {
     
+    private final YamlBroadcastRuleConfigurationSwapper ruleConfigSwapper = 
new YamlBroadcastRuleConfigurationSwapper();
+    
     private final RuleNodePath broadcastRuleNodePath = new 
BroadcastRuleNodePathProvider().getRuleNodePath();
     
     @Override
     public Collection<RepositoryTuple> swapToRepositoryTuples(final 
BroadcastRuleConfiguration data) {
         return data.getTables().isEmpty()
                 ? Collections.emptyList()
-                : Collections.singleton(new 
RepositoryTuple(BroadcastRuleNodePathProvider.TABLES, 
YamlEngine.marshal(swapToTablesYamlConfiguration(data))));
-    }
-    
-    private YamlBroadcastRuleConfiguration swapToTablesYamlConfiguration(final 
BroadcastRuleConfiguration data) {
-        YamlBroadcastRuleConfiguration result = new 
YamlBroadcastRuleConfiguration();
-        result.getTables().addAll(data.getTables());
-        return result;
+                : Collections.singleton(new 
RepositoryTuple(BroadcastRuleNodePathProvider.TABLES, 
YamlEngine.marshal(ruleConfigSwapper.swapToYamlConfiguration(data))));
     }
     
     @Override
@@ -57,7 +53,7 @@ public final class 
BroadcastRuleConfigurationRepositoryTupleSwapper implements R
         List<RepositoryTuple> validTuples = 
repositoryTuples.stream().filter(each -> 
broadcastRuleNodePath.getRoot().isValidatedPath(each.getKey())).collect(Collectors.toList());
         for (RepositoryTuple each : validTuples) {
             if 
(broadcastRuleNodePath.getRoot().isValidatedPath(each.getKey())) {
-                return Optional.of(new 
BroadcastRuleConfiguration(YamlEngine.unmarshal(each.getValue(), 
YamlBroadcastRuleConfiguration.class).getTables()));
+                return 
Optional.of(ruleConfigSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(),
 YamlBroadcastRuleConfiguration.class)));
             }
         }
         return Optional.empty();
diff --git 
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/EncryptRuleConfigurationRepositoryTupleSwapper.java
 
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/EncryptRuleConfigurationRepositoryTupleSwapper.java
index 50ccaff714e..6d04bcdbabe 100644
--- 
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/EncryptRuleConfigurationRepositoryTupleSwapper.java
+++ 
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/EncryptRuleConfigurationRepositoryTupleSwapper.java
@@ -18,18 +18,15 @@
 package org.apache.shardingsphere.encrypt.yaml.swapper;
 
 import org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
-import 
org.apache.shardingsphere.encrypt.api.config.rule.EncryptTableRuleConfiguration;
 import org.apache.shardingsphere.encrypt.constant.EncryptOrder;
 import 
org.apache.shardingsphere.encrypt.metadata.nodepath.EncryptRuleNodePathProvider;
+import 
org.apache.shardingsphere.encrypt.yaml.config.YamlEncryptRuleConfiguration;
 import 
org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfiguration;
-import 
org.apache.shardingsphere.encrypt.yaml.swapper.rule.YamlEncryptTableRuleConfigurationSwapper;
-import 
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
 import 
org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfiguration;
-import 
org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfigurationSwapper;
 import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
 import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
-import org.apache.shardingsphere.mode.spi.RepositoryTupleSwapper;
 import org.apache.shardingsphere.mode.path.RuleNodePath;
+import org.apache.shardingsphere.mode.spi.RepositoryTupleSwapper;
 
 import java.util.Collection;
 import java.util.LinkedHashMap;
@@ -45,22 +42,19 @@ import java.util.stream.Collectors;
  */
 public final class EncryptRuleConfigurationRepositoryTupleSwapper implements 
RepositoryTupleSwapper<EncryptRuleConfiguration> {
     
-    private final YamlEncryptTableRuleConfigurationSwapper tableSwapper = new 
YamlEncryptTableRuleConfigurationSwapper();
-    
-    private final YamlAlgorithmConfigurationSwapper algorithmSwapper = new 
YamlAlgorithmConfigurationSwapper();
+    private final YamlEncryptRuleConfigurationSwapper ruleConfigSwapper = new 
YamlEncryptRuleConfigurationSwapper();
     
     private final RuleNodePath encryptRuleNodePath = new 
EncryptRuleNodePathProvider().getRuleNodePath();
     
     @Override
     public Collection<RepositoryTuple> swapToRepositoryTuples(final 
EncryptRuleConfiguration data) {
         Collection<RepositoryTuple> result = new LinkedList<>();
-        for (Entry<String, AlgorithmConfiguration> entry : 
data.getEncryptors().entrySet()) {
-            result.add(new RepositoryTuple(
-                    
encryptRuleNodePath.getNamedItem(EncryptRuleNodePathProvider.ENCRYPTORS).getPath(entry.getKey()),
 
YamlEngine.marshal(algorithmSwapper.swapToYamlConfiguration(entry.getValue()))));
+        YamlEncryptRuleConfiguration yamlConfig = 
ruleConfigSwapper.swapToYamlConfiguration(data);
+        for (Entry<String, YamlAlgorithmConfiguration> entry : 
yamlConfig.getEncryptors().entrySet()) {
+            result.add(new 
RepositoryTuple(encryptRuleNodePath.getNamedItem(EncryptRuleNodePathProvider.ENCRYPTORS).getPath(entry.getKey()),
 YamlEngine.marshal(entry.getValue())));
         }
-        for (EncryptTableRuleConfiguration each : data.getTables()) {
-            result.add(new RepositoryTuple(
-                    
encryptRuleNodePath.getNamedItem(EncryptRuleNodePathProvider.TABLES).getPath(each.getName()),
 YamlEngine.marshal(tableSwapper.swapToYamlConfiguration(each))));
+        for (YamlEncryptTableRuleConfiguration each : 
yamlConfig.getTables().values()) {
+            result.add(new 
RepositoryTuple(encryptRuleNodePath.getNamedItem(EncryptRuleNodePathProvider.TABLES).getPath(each.getName()),
 YamlEngine.marshal(each)));
         }
         return result;
     }
@@ -71,15 +65,18 @@ public final class 
EncryptRuleConfigurationRepositoryTupleSwapper implements Rep
         if (validTuples.isEmpty()) {
             return Optional.empty();
         }
-        Collection<EncryptTableRuleConfiguration> tables = new LinkedList<>();
-        Map<String, AlgorithmConfiguration> encryptors = new LinkedHashMap<>();
+        Map<String, YamlEncryptTableRuleConfiguration> tables = new 
LinkedHashMap<>();
+        Map<String, YamlAlgorithmConfiguration> encryptors = new 
LinkedHashMap<>();
         for (RepositoryTuple each : validTuples) {
             
encryptRuleNodePath.getNamedItem(EncryptRuleNodePathProvider.TABLES).getName(each.getKey())
-                    .ifPresent(optional -> 
tables.add(tableSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlEncryptTableRuleConfiguration.class))));
+                    .ifPresent(optional -> tables.put(optional, 
YamlEngine.unmarshal(each.getValue(), 
YamlEncryptTableRuleConfiguration.class)));
             
encryptRuleNodePath.getNamedItem(EncryptRuleNodePathProvider.ENCRYPTORS).getName(each.getKey())
-                    .ifPresent(optional -> encryptors.put(optional, 
algorithmSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlAlgorithmConfiguration.class))));
+                    .ifPresent(optional -> encryptors.put(optional, 
YamlEngine.unmarshal(each.getValue(), YamlAlgorithmConfiguration.class)));
         }
-        return Optional.of(new EncryptRuleConfiguration(tables, encryptors));
+        YamlEncryptRuleConfiguration yamlRuleConfig = new 
YamlEncryptRuleConfiguration();
+        yamlRuleConfig.setTables(tables);
+        yamlRuleConfig.setEncryptors(encryptors);
+        return Optional.of(ruleConfigSwapper.swapToObject(yamlRuleConfig));
     }
     
     @Override
diff --git 
a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/yaml/swapper/MaskRuleConfigurationRepositoryTupleSwapper.java
 
b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/yaml/swapper/MaskRuleConfigurationRepositoryTupleSwapper.java
index 9ed31e5bdf9..fe15f8bf0bf 100644
--- 
a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/yaml/swapper/MaskRuleConfigurationRepositoryTupleSwapper.java
+++ 
b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/yaml/swapper/MaskRuleConfigurationRepositoryTupleSwapper.java
@@ -17,19 +17,16 @@
 
 package org.apache.shardingsphere.mask.yaml.swapper;
 
-import 
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
 import 
org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfiguration;
-import 
org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfigurationSwapper;
 import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
 import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
-import org.apache.shardingsphere.mode.spi.RepositoryTupleSwapper;
 import org.apache.shardingsphere.mask.api.config.MaskRuleConfiguration;
-import 
org.apache.shardingsphere.mask.api.config.rule.MaskTableRuleConfiguration;
 import org.apache.shardingsphere.mask.constant.MaskOrder;
 import 
org.apache.shardingsphere.mask.metadata.nodepath.MaskRuleNodePathProvider;
+import org.apache.shardingsphere.mask.yaml.config.YamlMaskRuleConfiguration;
 import 
org.apache.shardingsphere.mask.yaml.config.rule.YamlMaskTableRuleConfiguration;
-import 
org.apache.shardingsphere.mask.yaml.swapper.rule.YamlMaskTableRuleConfigurationSwapper;
 import org.apache.shardingsphere.mode.path.RuleNodePath;
+import org.apache.shardingsphere.mode.spi.RepositoryTupleSwapper;
 
 import java.util.Collection;
 import java.util.LinkedHashMap;
@@ -45,21 +42,19 @@ import java.util.stream.Collectors;
  */
 public final class MaskRuleConfigurationRepositoryTupleSwapper implements 
RepositoryTupleSwapper<MaskRuleConfiguration> {
     
-    private final YamlMaskTableRuleConfigurationSwapper tableSwapper = new 
YamlMaskTableRuleConfigurationSwapper();
-    
-    private final YamlAlgorithmConfigurationSwapper algorithmSwapper = new 
YamlAlgorithmConfigurationSwapper();
+    private final YamlMaskRuleConfigurationSwapper ruleConfigSwapper = new 
YamlMaskRuleConfigurationSwapper();
     
     private final RuleNodePath maskRuleNodePath = new 
MaskRuleNodePathProvider().getRuleNodePath();
     
     @Override
     public Collection<RepositoryTuple> swapToRepositoryTuples(final 
MaskRuleConfiguration data) {
         Collection<RepositoryTuple> result = new LinkedList<>();
-        for (Entry<String, AlgorithmConfiguration> entry : 
data.getMaskAlgorithms().entrySet()) {
-            result.add(new RepositoryTuple(
-                    
maskRuleNodePath.getNamedItem(MaskRuleNodePathProvider.MASK_ALGORITHMS).getPath(entry.getKey()),
 
YamlEngine.marshal(algorithmSwapper.swapToYamlConfiguration(entry.getValue()))));
+        YamlMaskRuleConfiguration yamlRuleConfig = 
ruleConfigSwapper.swapToYamlConfiguration(data);
+        for (Entry<String, YamlAlgorithmConfiguration> entry : 
yamlRuleConfig.getMaskAlgorithms().entrySet()) {
+            result.add(new 
RepositoryTuple(maskRuleNodePath.getNamedItem(MaskRuleNodePathProvider.MASK_ALGORITHMS).getPath(entry.getKey()),
 YamlEngine.marshal(entry.getValue())));
         }
-        for (MaskTableRuleConfiguration each : data.getTables()) {
-            result.add(new 
RepositoryTuple(maskRuleNodePath.getNamedItem(MaskRuleNodePathProvider.TABLES).getPath(each.getName()),
 YamlEngine.marshal(tableSwapper.swapToYamlConfiguration(each))));
+        for (YamlMaskTableRuleConfiguration each : 
yamlRuleConfig.getTables().values()) {
+            result.add(new 
RepositoryTuple(maskRuleNodePath.getNamedItem(MaskRuleNodePathProvider.TABLES).getPath(each.getName()),
 YamlEngine.marshal(each)));
         }
         return result;
     }
@@ -70,15 +65,18 @@ public final class 
MaskRuleConfigurationRepositoryTupleSwapper implements Reposi
         if (validTuples.isEmpty()) {
             return Optional.empty();
         }
-        Collection<MaskTableRuleConfiguration> tables = new LinkedList<>();
-        Map<String, AlgorithmConfiguration> algorithms = new LinkedHashMap<>();
+        Map<String, YamlMaskTableRuleConfiguration> tables = new 
LinkedHashMap<>();
+        Map<String, YamlAlgorithmConfiguration> maskAlgorithms = new 
LinkedHashMap<>();
         for (RepositoryTuple each : validTuples) {
             
maskRuleNodePath.getNamedItem(MaskRuleNodePathProvider.TABLES).getName(each.getKey())
-                    .ifPresent(optional -> 
tables.add(tableSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlMaskTableRuleConfiguration.class))));
+                    .ifPresent(optional -> tables.put(optional, 
YamlEngine.unmarshal(each.getValue(), YamlMaskTableRuleConfiguration.class)));
             
maskRuleNodePath.getNamedItem(MaskRuleNodePathProvider.MASK_ALGORITHMS).getName(each.getKey())
-                    .ifPresent(optional -> algorithms.put(optional, 
algorithmSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlAlgorithmConfiguration.class))));
+                    .ifPresent(optional -> maskAlgorithms.put(optional, 
YamlEngine.unmarshal(each.getValue(), YamlAlgorithmConfiguration.class)));
         }
-        return Optional.of(new MaskRuleConfiguration(tables, algorithms));
+        YamlMaskRuleConfiguration yamlRuleConfig = new 
YamlMaskRuleConfiguration();
+        yamlRuleConfig.setTables(tables);
+        yamlRuleConfig.setMaskAlgorithms(maskAlgorithms);
+        return Optional.of(ruleConfigSwapper.swapToObject(yamlRuleConfig));
     }
     
     @Override
diff --git 
a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/yaml/swapper/ReadwriteSplittingRuleConfigurationRepositoryTupleSwapper.java
 
b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/yaml/swapper/ReadwriteSplittingRuleConfigurationRepositoryTupleSwapper.java
index 5f91cfd64f3..c4178d5b95b 100644
--- 
a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/yaml/swapper/ReadwriteSplittingRuleConfigurationRepositoryTupleSwapper.java
+++ 
b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/yaml/swapper/ReadwriteSplittingRuleConfigurationRepositoryTupleSwapper.java
@@ -17,19 +17,15 @@
 
 package org.apache.shardingsphere.readwritesplitting.yaml.swapper;
 
-import com.google.common.base.Strings;
-import 
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
 import 
org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfiguration;
-import 
org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfigurationSwapper;
 import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
 import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
-import org.apache.shardingsphere.mode.spi.RepositoryTupleSwapper;
 import org.apache.shardingsphere.mode.path.RuleNodePath;
+import org.apache.shardingsphere.mode.spi.RepositoryTupleSwapper;
 import 
org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
-import 
org.apache.shardingsphere.readwritesplitting.api.rule.ReadwriteSplittingDataSourceGroupRuleConfiguration;
-import 
org.apache.shardingsphere.readwritesplitting.api.transaction.TransactionalReadQueryStrategy;
 import 
org.apache.shardingsphere.readwritesplitting.constant.ReadwriteSplittingOrder;
 import 
org.apache.shardingsphere.readwritesplitting.metadata.nodepath.ReadwriteSplittingRuleNodePathProvider;
+import 
org.apache.shardingsphere.readwritesplitting.yaml.config.YamlReadwriteSplittingRuleConfiguration;
 import 
org.apache.shardingsphere.readwritesplitting.yaml.config.rule.YamlReadwriteSplittingDataSourceGroupRuleConfiguration;
 
 import java.util.Collection;
@@ -46,59 +42,43 @@ import java.util.stream.Collectors;
  */
 public final class ReadwriteSplittingRuleConfigurationRepositoryTupleSwapper 
implements RepositoryTupleSwapper<ReadwriteSplittingRuleConfiguration> {
     
-    private final YamlAlgorithmConfigurationSwapper algorithmSwapper = new 
YamlAlgorithmConfigurationSwapper();
+    private final YamlReadwriteSplittingRuleConfigurationSwapper 
ruleConfigSwapper = new YamlReadwriteSplittingRuleConfigurationSwapper();
     
     private final RuleNodePath readwriteSplittingRuleNodePath = new 
ReadwriteSplittingRuleNodePathProvider().getRuleNodePath();
     
     @Override
     public Collection<RepositoryTuple> swapToRepositoryTuples(final 
ReadwriteSplittingRuleConfiguration data) {
         Collection<RepositoryTuple> result = new LinkedList<>();
-        for (Entry<String, AlgorithmConfiguration> entry : 
data.getLoadBalancers().entrySet()) {
+        YamlReadwriteSplittingRuleConfiguration yamlRuleConfig = 
ruleConfigSwapper.swapToYamlConfiguration(data);
+        for (Entry<String, YamlAlgorithmConfiguration> entry : 
yamlRuleConfig.getLoadBalancers().entrySet()) {
             result.add(new 
RepositoryTuple(readwriteSplittingRuleNodePath.getNamedItem(ReadwriteSplittingRuleNodePathProvider.LOAD_BALANCERS).getPath(entry.getKey()),
-                    
YamlEngine.marshal(algorithmSwapper.swapToYamlConfiguration(entry.getValue()))));
+                    YamlEngine.marshal(entry.getValue())));
         }
-        for (ReadwriteSplittingDataSourceGroupRuleConfiguration each : 
data.getDataSourceGroups()) {
-            result.add(new 
RepositoryTuple(readwriteSplittingRuleNodePath.getNamedItem(ReadwriteSplittingRuleNodePathProvider.DATA_SOURCES).getPath(each.getName()),
-                    YamlEngine.marshal(swapToYamlConfiguration(each))));
+        for (Entry<String, 
YamlReadwriteSplittingDataSourceGroupRuleConfiguration> entry : 
yamlRuleConfig.getDataSourceGroups().entrySet()) {
+            result.add(new RepositoryTuple(
+                    
readwriteSplittingRuleNodePath.getNamedItem(ReadwriteSplittingRuleNodePathProvider.DATA_SOURCES).getPath(entry.getKey()),
 YamlEngine.marshal(entry.getValue())));
         }
         return result;
     }
     
-    private YamlReadwriteSplittingDataSourceGroupRuleConfiguration 
swapToYamlConfiguration(final 
ReadwriteSplittingDataSourceGroupRuleConfiguration dataSourceGroupRuleConfig) {
-        YamlReadwriteSplittingDataSourceGroupRuleConfiguration result = new 
YamlReadwriteSplittingDataSourceGroupRuleConfiguration();
-        
result.setWriteDataSourceName(dataSourceGroupRuleConfig.getWriteDataSourceName());
-        
result.setReadDataSourceNames(dataSourceGroupRuleConfig.getReadDataSourceNames());
-        
result.setTransactionalReadQueryStrategy(dataSourceGroupRuleConfig.getTransactionalReadQueryStrategy().name());
-        
result.setLoadBalancerName(dataSourceGroupRuleConfig.getLoadBalancerName());
-        return result;
-    }
-    
     @Override
     public Optional<ReadwriteSplittingRuleConfiguration> swapToObject(final 
Collection<RepositoryTuple> repositoryTuples) {
         List<RepositoryTuple> validRepositoryTuples = 
repositoryTuples.stream().filter(each -> 
readwriteSplittingRuleNodePath.getRoot().isValidatedPath(each.getKey())).collect(Collectors.toList());
         if (validRepositoryTuples.isEmpty()) {
             return Optional.empty();
         }
-        Collection<ReadwriteSplittingDataSourceGroupRuleConfiguration> 
dataSourceGroups = new LinkedList<>();
-        Map<String, AlgorithmConfiguration> loadBalancerMap = new 
LinkedHashMap<>();
+        Map<String, YamlReadwriteSplittingDataSourceGroupRuleConfiguration> 
dataSourceGroups = new LinkedHashMap<>();
+        Map<String, YamlAlgorithmConfiguration> loadBalancers = new 
LinkedHashMap<>();
         for (RepositoryTuple each : validRepositoryTuples) {
             
readwriteSplittingRuleNodePath.getNamedItem(ReadwriteSplittingRuleNodePathProvider.DATA_SOURCES).getName(each.getKey())
-                    .ifPresent(optional -> 
dataSourceGroups.add(swapDataSourceGroup(optional, 
YamlEngine.unmarshal(each.getValue(), 
YamlReadwriteSplittingDataSourceGroupRuleConfiguration.class))));
+                    .ifPresent(optional -> dataSourceGroups.put(optional, 
YamlEngine.unmarshal(each.getValue(), 
YamlReadwriteSplittingDataSourceGroupRuleConfiguration.class)));
             
readwriteSplittingRuleNodePath.getNamedItem(ReadwriteSplittingRuleNodePathProvider.LOAD_BALANCERS).getName(each.getKey())
-                    .ifPresent(optional -> loadBalancerMap.put(optional, 
algorithmSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlAlgorithmConfiguration.class))));
+                    .ifPresent(optional -> loadBalancers.put(optional, 
YamlEngine.unmarshal(each.getValue(), YamlAlgorithmConfiguration.class)));
         }
-        return Optional.of(new 
ReadwriteSplittingRuleConfiguration(dataSourceGroups, loadBalancerMap));
-    }
-    
-    private ReadwriteSplittingDataSourceGroupRuleConfiguration 
swapDataSourceGroup(final String name, final 
YamlReadwriteSplittingDataSourceGroupRuleConfiguration 
yamlDataSourceRuleConfig) {
-        return new ReadwriteSplittingDataSourceGroupRuleConfiguration(name, 
yamlDataSourceRuleConfig.getWriteDataSourceName(), 
yamlDataSourceRuleConfig.getReadDataSourceNames(),
-                getTransactionalReadQueryStrategy(yamlDataSourceRuleConfig), 
yamlDataSourceRuleConfig.getLoadBalancerName());
-    }
-    
-    private TransactionalReadQueryStrategy 
getTransactionalReadQueryStrategy(final 
YamlReadwriteSplittingDataSourceGroupRuleConfiguration 
yamlDataSourceGroupRuleConfig) {
-        return 
Strings.isNullOrEmpty(yamlDataSourceGroupRuleConfig.getTransactionalReadQueryStrategy())
-                ? TransactionalReadQueryStrategy.DYNAMIC
-                : 
TransactionalReadQueryStrategy.valueOf(yamlDataSourceGroupRuleConfig.getTransactionalReadQueryStrategy());
+        YamlReadwriteSplittingRuleConfiguration yamlRuleConfig = new 
YamlReadwriteSplittingRuleConfiguration();
+        yamlRuleConfig.setDataSourceGroups(dataSourceGroups);
+        yamlRuleConfig.setLoadBalancers(loadBalancers);
+        return Optional.of(ruleConfigSwapper.swapToObject(yamlRuleConfig));
     }
     
     @Override
diff --git 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/yaml/swapper/ShadowRuleConfigurationRepositoryTupleSwapper.java
 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/yaml/swapper/ShadowRuleConfigurationRepositoryTupleSwapper.java
index e27954a6867..3addd29b907 100644
--- 
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/yaml/swapper/ShadowRuleConfigurationRepositoryTupleSwapper.java
+++ 
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/yaml/swapper/ShadowRuleConfigurationRepositoryTupleSwapper.java
@@ -18,25 +18,23 @@
 package org.apache.shardingsphere.shadow.yaml.swapper;
 
 import com.google.common.base.Strings;
-import 
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
 import 
org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfiguration;
-import 
org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfigurationSwapper;
 import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
 import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
-import org.apache.shardingsphere.mode.spi.RepositoryTupleSwapper;
 import org.apache.shardingsphere.mode.path.RuleNodePath;
+import org.apache.shardingsphere.mode.spi.RepositoryTupleSwapper;
 import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
-import 
org.apache.shardingsphere.shadow.api.config.datasource.ShadowDataSourceConfiguration;
-import 
org.apache.shardingsphere.shadow.api.config.table.ShadowTableConfiguration;
 import org.apache.shardingsphere.shadow.constant.ShadowOrder;
 import 
org.apache.shardingsphere.shadow.metadata.nodepath.ShadowRuleNodePathProvider;
+import 
org.apache.shardingsphere.shadow.yaml.config.YamlShadowRuleConfiguration;
 import 
org.apache.shardingsphere.shadow.yaml.config.datasource.YamlShadowDataSourceConfiguration;
 import 
org.apache.shardingsphere.shadow.yaml.config.table.YamlShadowTableConfiguration;
-import 
org.apache.shardingsphere.shadow.yaml.swapper.table.YamlShadowTableConfigurationSwapper;
 
 import java.util.Collection;
+import java.util.LinkedHashMap;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Optional;
 import java.util.stream.Collectors;
@@ -46,63 +44,54 @@ import java.util.stream.Collectors;
  */
 public final class ShadowRuleConfigurationRepositoryTupleSwapper implements 
RepositoryTupleSwapper<ShadowRuleConfiguration> {
     
-    private final YamlShadowTableConfigurationSwapper tableSwapper = new 
YamlShadowTableConfigurationSwapper();
-    
-    private final YamlAlgorithmConfigurationSwapper algorithmSwapper = new 
YamlAlgorithmConfigurationSwapper();
+    private final YamlShadowRuleConfigurationSwapper ruleConfigSwapper = new 
YamlShadowRuleConfigurationSwapper();
     
     private final RuleNodePath shadowRuleNodePath = new 
ShadowRuleNodePathProvider().getRuleNodePath();
     
     @Override
     public Collection<RepositoryTuple> swapToRepositoryTuples(final 
ShadowRuleConfiguration data) {
         Collection<RepositoryTuple> result = new LinkedList<>();
-        for (Entry<String, AlgorithmConfiguration> entry : 
data.getShadowAlgorithms().entrySet()) {
-            result.add(new 
RepositoryTuple(shadowRuleNodePath.getNamedItem(ShadowRuleNodePathProvider.ALGORITHMS).getPath(entry.getKey()),
-                    
YamlEngine.marshal(algorithmSwapper.swapToYamlConfiguration(entry.getValue()))));
+        YamlShadowRuleConfiguration yamlRuleConfig = 
ruleConfigSwapper.swapToYamlConfiguration(data);
+        for (Entry<String, YamlAlgorithmConfiguration> entry : 
yamlRuleConfig.getShadowAlgorithms().entrySet()) {
+            result.add(new 
RepositoryTuple(shadowRuleNodePath.getNamedItem(ShadowRuleNodePathProvider.ALGORITHMS).getPath(entry.getKey()),
 YamlEngine.marshal(entry.getValue())));
         }
-        if (!Strings.isNullOrEmpty(data.getDefaultShadowAlgorithmName())) {
-            result.add(new 
RepositoryTuple(shadowRuleNodePath.getUniqueItem(ShadowRuleNodePathProvider.DEFAULT_ALGORITHM).getPath(),
 data.getDefaultShadowAlgorithmName()));
+        if 
(!Strings.isNullOrEmpty(yamlRuleConfig.getDefaultShadowAlgorithmName())) {
+            result.add(new 
RepositoryTuple(shadowRuleNodePath.getUniqueItem(ShadowRuleNodePathProvider.DEFAULT_ALGORITHM).getPath(),
 yamlRuleConfig.getDefaultShadowAlgorithmName()));
         }
-        for (ShadowDataSourceConfiguration each : data.getDataSources()) {
-            result.add(new 
RepositoryTuple(shadowRuleNodePath.getNamedItem(ShadowRuleNodePathProvider.DATA_SOURCES).getPath(each.getName()),
-                    
YamlEngine.marshal(swapToDataSourceYamlConfiguration(each))));
+        for (Entry<String, YamlShadowDataSourceConfiguration> entry : 
yamlRuleConfig.getDataSources().entrySet()) {
+            result.add(new 
RepositoryTuple(shadowRuleNodePath.getNamedItem(ShadowRuleNodePathProvider.DATA_SOURCES).getPath(entry.getKey()),
 YamlEngine.marshal(entry.getValue())));
         }
-        for (Entry<String, ShadowTableConfiguration> entry : 
data.getTables().entrySet()) {
-            result.add(new 
RepositoryTuple(shadowRuleNodePath.getNamedItem(ShadowRuleNodePathProvider.TABLES).getPath(entry.getKey()),
-                    
YamlEngine.marshal(tableSwapper.swapToYamlConfiguration(entry.getValue()))));
+        for (Entry<String, YamlShadowTableConfiguration> entry : 
yamlRuleConfig.getTables().entrySet()) {
+            result.add(new 
RepositoryTuple(shadowRuleNodePath.getNamedItem(ShadowRuleNodePathProvider.TABLES).getPath(entry.getKey()),
 YamlEngine.marshal(entry.getValue())));
         }
         return result;
     }
     
-    private YamlShadowDataSourceConfiguration 
swapToDataSourceYamlConfiguration(final ShadowDataSourceConfiguration data) {
-        YamlShadowDataSourceConfiguration result = new 
YamlShadowDataSourceConfiguration();
-        result.setProductionDataSourceName(data.getProductionDataSourceName());
-        result.setShadowDataSourceName(data.getShadowDataSourceName());
-        return result;
-    }
-    
     @Override
     public Optional<ShadowRuleConfiguration> swapToObject(final 
Collection<RepositoryTuple> repositoryTuples) {
         List<RepositoryTuple> validRepositoryTuples = 
repositoryTuples.stream().filter(each -> 
shadowRuleNodePath.getRoot().isValidatedPath(each.getKey())).collect(Collectors.toList());
         if (validRepositoryTuples.isEmpty()) {
             return Optional.empty();
         }
-        ShadowRuleConfiguration result = new ShadowRuleConfiguration();
+        YamlShadowRuleConfiguration yamlRuleConfig = new 
YamlShadowRuleConfiguration();
+        Map<String, YamlShadowDataSourceConfiguration> dataSources = new 
LinkedHashMap<>();
+        Map<String, YamlShadowTableConfiguration> tables = new 
LinkedHashMap<>();
+        Map<String, YamlAlgorithmConfiguration> shadowAlgorithms = new 
LinkedHashMap<>();
         for (RepositoryTuple each : validRepositoryTuples) {
             
shadowRuleNodePath.getNamedItem(ShadowRuleNodePathProvider.DATA_SOURCES).getName(each.getKey())
-                    .ifPresent(optional -> 
result.getDataSources().add(swapDataSource(optional, 
YamlEngine.unmarshal(each.getValue(), 
YamlShadowDataSourceConfiguration.class))));
+                    .ifPresent(optional -> dataSources.put(optional, 
YamlEngine.unmarshal(each.getValue(), 
YamlShadowDataSourceConfiguration.class)));
             
shadowRuleNodePath.getNamedItem(ShadowRuleNodePathProvider.TABLES).getName(each.getKey())
-                    .ifPresent(optional -> result.getTables().put(optional, 
tableSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlShadowTableConfiguration.class))));
+                    .ifPresent(optional -> tables.put(optional, 
YamlEngine.unmarshal(each.getValue(), YamlShadowTableConfiguration.class)));
             
shadowRuleNodePath.getNamedItem(ShadowRuleNodePathProvider.ALGORITHMS).getName(each.getKey())
-                    .ifPresent(optional -> 
result.getShadowAlgorithms().put(optional, 
algorithmSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlAlgorithmConfiguration.class))));
+                    .ifPresent(optional -> shadowAlgorithms.put(optional, 
YamlEngine.unmarshal(each.getValue(), YamlAlgorithmConfiguration.class)));
             if 
(shadowRuleNodePath.getUniqueItem(ShadowRuleNodePathProvider.DEFAULT_ALGORITHM).isValidatedPath(each.getKey()))
 {
-                result.setDefaultShadowAlgorithmName(each.getValue());
+                yamlRuleConfig.setDefaultShadowAlgorithmName(each.getValue());
             }
         }
-        return Optional.of(result);
-    }
-    
-    private ShadowDataSourceConfiguration swapDataSource(final String name, 
final YamlShadowDataSourceConfiguration yamlConfig) {
-        return new ShadowDataSourceConfiguration(name, 
yamlConfig.getProductionDataSourceName(), yamlConfig.getShadowDataSourceName());
+        yamlRuleConfig.setDataSources(dataSources);
+        yamlRuleConfig.setTables(tables);
+        yamlRuleConfig.setShadowAlgorithms(shadowAlgorithms);
+        return Optional.of(ruleConfigSwapper.swapToObject(yamlRuleConfig));
     }
     
     @Override
diff --git 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleConfigurationRepositoryTupleSwapper.java
 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleConfigurationRepositoryTupleSwapper.java
index 352a5d44095..9e006c07014 100644
--- 
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleConfigurationRepositoryTupleSwapper.java
+++ 
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/swapper/ShardingRuleConfigurationRepositoryTupleSwapper.java
@@ -17,36 +17,27 @@
 
 package org.apache.shardingsphere.sharding.yaml.swapper;
 
-import 
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
 import 
org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfiguration;
-import 
org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfigurationSwapper;
 import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
 import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
-import org.apache.shardingsphere.mode.spi.RepositoryTupleSwapper;
 import org.apache.shardingsphere.mode.path.RuleNodePath;
+import org.apache.shardingsphere.mode.spi.RepositoryTupleSwapper;
 import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import 
org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
-import 
org.apache.shardingsphere.sharding.api.config.rule.ShardingTableReferenceRuleConfiguration;
-import 
org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
 import org.apache.shardingsphere.sharding.constant.ShardingOrder;
 import 
org.apache.shardingsphere.sharding.metadata.nodepath.ShardingRuleNodePathProvider;
+import 
org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration;
 import 
org.apache.shardingsphere.sharding.yaml.config.cache.YamlShardingCacheConfiguration;
 import 
org.apache.shardingsphere.sharding.yaml.config.rule.YamlShardingAutoTableRuleConfiguration;
 import 
org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfiguration;
 import 
org.apache.shardingsphere.sharding.yaml.config.strategy.audit.YamlShardingAuditStrategyConfiguration;
 import 
org.apache.shardingsphere.sharding.yaml.config.strategy.keygen.YamlKeyGenerateStrategyConfiguration;
 import 
org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration;
-import 
org.apache.shardingsphere.sharding.yaml.swapper.cache.YamlShardingCacheConfigurationSwapper;
-import 
org.apache.shardingsphere.sharding.yaml.swapper.rule.YamlShardingAutoTableRuleConfigurationSwapper;
-import 
org.apache.shardingsphere.sharding.yaml.swapper.rule.YamlShardingTableReferenceRuleConfigurationConverter;
-import 
org.apache.shardingsphere.sharding.yaml.swapper.rule.YamlShardingTableRuleConfigurationSwapper;
-import 
org.apache.shardingsphere.sharding.yaml.swapper.strategy.YamlKeyGenerateStrategyConfigurationSwapper;
-import 
org.apache.shardingsphere.sharding.yaml.swapper.strategy.YamlShardingAuditStrategyConfigurationSwapper;
-import 
org.apache.shardingsphere.sharding.yaml.swapper.strategy.YamlShardingStrategyConfigurationSwapper;
 
 import java.util.Collection;
+import java.util.LinkedHashMap;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Optional;
 import java.util.stream.Collectors;
@@ -56,122 +47,119 @@ import java.util.stream.Collectors;
  */
 public final class ShardingRuleConfigurationRepositoryTupleSwapper implements 
RepositoryTupleSwapper<ShardingRuleConfiguration> {
     
-    private final YamlShardingTableRuleConfigurationSwapper tableSwapper = new 
YamlShardingTableRuleConfigurationSwapper();
-    
-    private final YamlShardingAutoTableRuleConfigurationSwapper 
autoTableSwapper = new YamlShardingAutoTableRuleConfigurationSwapper();
-    
-    private final YamlShardingStrategyConfigurationSwapper 
shardingStrategySwapper = new YamlShardingStrategyConfigurationSwapper();
-    
-    private final YamlKeyGenerateStrategyConfigurationSwapper 
keyGenerateStrategySwapper = new YamlKeyGenerateStrategyConfigurationSwapper();
-    
-    private final YamlShardingAuditStrategyConfigurationSwapper 
auditStrategySwapper = new YamlShardingAuditStrategyConfigurationSwapper();
-    
-    private final YamlAlgorithmConfigurationSwapper algorithmSwapper = new 
YamlAlgorithmConfigurationSwapper();
-    
-    private final YamlShardingCacheConfigurationSwapper shardingCacheSwapper = 
new YamlShardingCacheConfigurationSwapper();
+    private final YamlShardingRuleConfigurationSwapper ruleConfigSwapper = new 
YamlShardingRuleConfigurationSwapper();
     
     private final RuleNodePath shardingRuleNodePath = new 
ShardingRuleNodePathProvider().getRuleNodePath();
     
     @Override
     public Collection<RepositoryTuple> swapToRepositoryTuples(final 
ShardingRuleConfiguration data) {
+        YamlShardingRuleConfiguration yamlRuleConfig = 
ruleConfigSwapper.swapToYamlConfiguration(data);
         Collection<RepositoryTuple> result = new LinkedList<>();
-        swapAlgorithms(data, result);
-        swapStrategies(data, result);
-        if (null != data.getDefaultShardingColumn()) {
-            result.add(new 
RepositoryTuple(shardingRuleNodePath.getUniqueItem(ShardingRuleNodePathProvider.DEFAULT_SHARDING_COLUMN).getPath(),
 data.getDefaultShardingColumn()));
+        swapAlgorithms(yamlRuleConfig, result);
+        swapStrategies(yamlRuleConfig, result);
+        if (null != yamlRuleConfig.getDefaultShardingColumn()) {
+            result.add(new 
RepositoryTuple(shardingRuleNodePath.getUniqueItem(ShardingRuleNodePathProvider.DEFAULT_SHARDING_COLUMN).getPath(),
 yamlRuleConfig.getDefaultShardingColumn()));
         }
-        if (null != data.getShardingCache()) {
-            result.add(new 
RepositoryTuple(shardingRuleNodePath.getUniqueItem(ShardingRuleNodePathProvider.SHARDING_CACHE).getPath(),
-                    
YamlEngine.marshal(shardingCacheSwapper.swapToYamlConfiguration(data.getShardingCache()))));
+        if (null != yamlRuleConfig.getShardingCache()) {
+            result.add(new 
RepositoryTuple(shardingRuleNodePath.getUniqueItem(ShardingRuleNodePathProvider.SHARDING_CACHE).getPath(),
 YamlEngine.marshal(yamlRuleConfig.getShardingCache())));
         }
-        swapTableRules(data, result);
+        swapTableRules(yamlRuleConfig, result);
         return result;
     }
     
-    private void swapAlgorithms(final ShardingRuleConfiguration data, final 
Collection<RepositoryTuple> repositoryTuples) {
-        for (Entry<String, AlgorithmConfiguration> each : 
data.getShardingAlgorithms().entrySet()) {
-            repositoryTuples.add(new RepositoryTuple(
-                    
shardingRuleNodePath.getNamedItem(ShardingRuleNodePathProvider.ALGORITHMS).getPath(each.getKey()),
 
YamlEngine.marshal(algorithmSwapper.swapToYamlConfiguration(each.getValue()))));
+    private void swapAlgorithms(final YamlShardingRuleConfiguration 
yamlRuleConfig, final Collection<RepositoryTuple> repositoryTuples) {
+        for (Entry<String, YamlAlgorithmConfiguration> each : 
yamlRuleConfig.getShardingAlgorithms().entrySet()) {
+            repositoryTuples.add(new 
RepositoryTuple(shardingRuleNodePath.getNamedItem(ShardingRuleNodePathProvider.ALGORITHMS).getPath(each.getKey()),
 YamlEngine.marshal(each.getValue())));
         }
-        for (Entry<String, AlgorithmConfiguration> each : 
data.getKeyGenerators().entrySet()) {
-            repositoryTuples.add(new 
RepositoryTuple(shardingRuleNodePath.getNamedItem(ShardingRuleNodePathProvider.KEY_GENERATORS).getPath(each.getKey()),
-                    
YamlEngine.marshal(algorithmSwapper.swapToYamlConfiguration(each.getValue()))));
+        for (Entry<String, YamlAlgorithmConfiguration> each : 
yamlRuleConfig.getKeyGenerators().entrySet()) {
+            repositoryTuples.add(new 
RepositoryTuple(shardingRuleNodePath.getNamedItem(ShardingRuleNodePathProvider.KEY_GENERATORS).getPath(each.getKey()),
 YamlEngine.marshal(each.getValue())));
         }
-        for (Entry<String, AlgorithmConfiguration> each : 
data.getAuditors().entrySet()) {
-            repositoryTuples.add(new RepositoryTuple(
-                    
shardingRuleNodePath.getNamedItem(ShardingRuleNodePathProvider.AUDITORS).getPath(each.getKey()),
 
YamlEngine.marshal(algorithmSwapper.swapToYamlConfiguration(each.getValue()))));
+        for (Entry<String, YamlAlgorithmConfiguration> each : 
yamlRuleConfig.getAuditors().entrySet()) {
+            repositoryTuples.add(new 
RepositoryTuple(shardingRuleNodePath.getNamedItem(ShardingRuleNodePathProvider.AUDITORS).getPath(each.getKey()),
 YamlEngine.marshal(each.getValue())));
         }
     }
     
-    private void swapStrategies(final ShardingRuleConfiguration data, final 
Collection<RepositoryTuple> repositoryTuples) {
-        if (null != data.getDefaultDatabaseShardingStrategy()) {
-            repositoryTuples.add(new 
RepositoryTuple(shardingRuleNodePath.getUniqueItem(ShardingRuleNodePathProvider.DEFAULT_DATABASE_STRATEGY).getPath(),
-                    
YamlEngine.marshal(shardingStrategySwapper.swapToYamlConfiguration(data.getDefaultDatabaseShardingStrategy()))));
+    private void swapStrategies(final YamlShardingRuleConfiguration 
yamlRuleConfig, final Collection<RepositoryTuple> repositoryTuples) {
+        if (null != yamlRuleConfig.getDefaultDatabaseStrategy()) {
+            repositoryTuples.add(new RepositoryTuple(
+                    
shardingRuleNodePath.getUniqueItem(ShardingRuleNodePathProvider.DEFAULT_DATABASE_STRATEGY).getPath(),
 YamlEngine.marshal(yamlRuleConfig.getDefaultDatabaseStrategy())));
         }
-        if (null != data.getDefaultTableShardingStrategy()) {
-            repositoryTuples.add(new 
RepositoryTuple(shardingRuleNodePath.getUniqueItem(ShardingRuleNodePathProvider.DEFAULT_TABLE_STRATEGY).getPath(),
-                    
YamlEngine.marshal(shardingStrategySwapper.swapToYamlConfiguration(data.getDefaultTableShardingStrategy()))));
+        if (null != yamlRuleConfig.getDefaultTableStrategy()) {
+            repositoryTuples.add(new RepositoryTuple(
+                    
shardingRuleNodePath.getUniqueItem(ShardingRuleNodePathProvider.DEFAULT_TABLE_STRATEGY).getPath(),
 YamlEngine.marshal(yamlRuleConfig.getDefaultTableStrategy())));
         }
-        if (null != data.getDefaultKeyGenerateStrategy()) {
-            repositoryTuples.add(new 
RepositoryTuple(shardingRuleNodePath.getUniqueItem(ShardingRuleNodePathProvider.DEFAULT_KEY_GENERATE_STRATEGY).getPath(),
-                    
YamlEngine.marshal(keyGenerateStrategySwapper.swapToYamlConfiguration(data.getDefaultKeyGenerateStrategy()))));
+        if (null != yamlRuleConfig.getDefaultKeyGenerateStrategy()) {
+            repositoryTuples.add(new RepositoryTuple(
+                    
shardingRuleNodePath.getUniqueItem(ShardingRuleNodePathProvider.DEFAULT_KEY_GENERATE_STRATEGY).getPath(),
 YamlEngine.marshal(yamlRuleConfig.getDefaultKeyGenerateStrategy())));
         }
-        if (null != data.getDefaultAuditStrategy()) {
-            repositoryTuples.add(new 
RepositoryTuple(shardingRuleNodePath.getUniqueItem(ShardingRuleNodePathProvider.DEFAULT_AUDIT_STRATEGY).getPath(),
-                    
YamlEngine.marshal(auditStrategySwapper.swapToYamlConfiguration(data.getDefaultAuditStrategy()))));
+        if (null != yamlRuleConfig.getDefaultAuditStrategy()) {
+            repositoryTuples.add(new RepositoryTuple(
+                    
shardingRuleNodePath.getUniqueItem(ShardingRuleNodePathProvider.DEFAULT_AUDIT_STRATEGY).getPath(),
 YamlEngine.marshal(yamlRuleConfig.getDefaultAuditStrategy())));
         }
     }
     
-    private void swapTableRules(final ShardingRuleConfiguration data, final 
Collection<RepositoryTuple> repositoryTuples) {
-        for (ShardingTableRuleConfiguration each : data.getTables()) {
-            repositoryTuples.add(new 
RepositoryTuple(shardingRuleNodePath.getNamedItem(ShardingRuleNodePathProvider.TABLES).getPath(each.getLogicTable()),
-                    
YamlEngine.marshal(tableSwapper.swapToYamlConfiguration(each))));
+    private void swapTableRules(final YamlShardingRuleConfiguration 
yamlRuleConfig, final Collection<RepositoryTuple> repositoryTuples) {
+        for (YamlTableRuleConfiguration each : 
yamlRuleConfig.getTables().values()) {
+            repositoryTuples.add(new 
RepositoryTuple(shardingRuleNodePath.getNamedItem(ShardingRuleNodePathProvider.TABLES).getPath(each.getLogicTable()),
 YamlEngine.marshal(each)));
         }
-        for (ShardingAutoTableRuleConfiguration each : data.getAutoTables()) {
-            repositoryTuples.add(new 
RepositoryTuple(shardingRuleNodePath.getNamedItem(ShardingRuleNodePathProvider.AUTO_TABLES).getPath(each.getLogicTable()),
-                    
YamlEngine.marshal(autoTableSwapper.swapToYamlConfiguration(each))));
+        for (YamlShardingAutoTableRuleConfiguration each : 
yamlRuleConfig.getAutoTables().values()) {
+            repositoryTuples.add(new 
RepositoryTuple(shardingRuleNodePath.getNamedItem(ShardingRuleNodePathProvider.AUTO_TABLES).getPath(each.getLogicTable()),
 YamlEngine.marshal(each)));
         }
-        for (ShardingTableReferenceRuleConfiguration each : 
data.getBindingTableGroups()) {
-            repositoryTuples.add(new 
RepositoryTuple(shardingRuleNodePath.getNamedItem(ShardingRuleNodePathProvider.BINDING_TABLES).getPath(each.getName()),
-                    
YamlShardingTableReferenceRuleConfigurationConverter.convertToYamlString(each)));
+        for (String each : yamlRuleConfig.getBindingTables()) {
+            repositoryTuples.add(new 
RepositoryTuple(shardingRuleNodePath.getNamedItem(ShardingRuleNodePathProvider.BINDING_TABLES).getPath(getBindingGroupName(each)),
 each));
         }
     }
     
+    private String getBindingGroupName(final String bindingGroup) {
+        return bindingGroup.contains(":") ? bindingGroup.substring(0, 
bindingGroup.indexOf(":")) : bindingGroup;
+    }
+    
     @Override
     public Optional<ShardingRuleConfiguration> swapToObject(final 
Collection<RepositoryTuple> repositoryTuples) {
         List<RepositoryTuple> validRepositoryTuples = 
repositoryTuples.stream().filter(each -> 
shardingRuleNodePath.getRoot().isValidatedPath(each.getKey())).collect(Collectors.toList());
         if (validRepositoryTuples.isEmpty()) {
             return Optional.empty();
         }
-        ShardingRuleConfiguration result = new ShardingRuleConfiguration();
+        YamlShardingRuleConfiguration yamlRuleConfig = new 
YamlShardingRuleConfiguration();
+        Map<String, YamlTableRuleConfiguration> tables = new LinkedHashMap<>();
+        Map<String, YamlShardingAutoTableRuleConfiguration> autoTables = new 
LinkedHashMap<>();
+        Collection<String> bindingTables = new LinkedList<>();
+        Map<String, YamlAlgorithmConfiguration> shardingAlgorithms = new 
LinkedHashMap<>();
+        Map<String, YamlAlgorithmConfiguration> keyGenerators = new 
LinkedHashMap<>();
+        Map<String, YamlAlgorithmConfiguration> auditors = new 
LinkedHashMap<>();
         for (RepositoryTuple each : validRepositoryTuples) {
             
shardingRuleNodePath.getNamedItem(ShardingRuleNodePathProvider.TABLES).getName(each.getKey())
-                    .ifPresent(optional -> 
result.getTables().add(tableSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(),
 YamlTableRuleConfiguration.class))));
+                    .ifPresent(optional -> tables.put(optional, 
YamlEngine.unmarshal(each.getValue(), YamlTableRuleConfiguration.class)));
             
shardingRuleNodePath.getNamedItem(ShardingRuleNodePathProvider.AUTO_TABLES).getName(each.getKey())
-                    .ifPresent(optional -> 
result.getAutoTables().add(autoTableSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(),
 YamlShardingAutoTableRuleConfiguration.class))));
-            
shardingRuleNodePath.getNamedItem(ShardingRuleNodePathProvider.BINDING_TABLES).getName(each.getKey())
-                    .ifPresent(optional -> 
result.getBindingTableGroups().add(YamlShardingTableReferenceRuleConfigurationConverter.convertToObject(each.getValue())));
+                    .ifPresent(optional -> autoTables.put(optional, 
YamlEngine.unmarshal(each.getValue(), 
YamlShardingAutoTableRuleConfiguration.class)));
+            
shardingRuleNodePath.getNamedItem(ShardingRuleNodePathProvider.BINDING_TABLES).getName(each.getKey()).ifPresent(optional
 -> bindingTables.add(each.getValue()));
             
shardingRuleNodePath.getNamedItem(ShardingRuleNodePathProvider.ALGORITHMS).getName(each.getKey())
-                    .ifPresent(optional -> 
result.getShardingAlgorithms().put(optional, 
algorithmSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlAlgorithmConfiguration.class))));
+                    .ifPresent(optional -> shardingAlgorithms.put(optional, 
YamlEngine.unmarshal(each.getValue(), YamlAlgorithmConfiguration.class)));
             
shardingRuleNodePath.getNamedItem(ShardingRuleNodePathProvider.KEY_GENERATORS).getName(each.getKey())
-                    .ifPresent(optional -> 
result.getKeyGenerators().put(optional, 
algorithmSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlAlgorithmConfiguration.class))));
+                    .ifPresent(optional -> keyGenerators.put(optional, 
YamlEngine.unmarshal(each.getValue(), YamlAlgorithmConfiguration.class)));
             
shardingRuleNodePath.getNamedItem(ShardingRuleNodePathProvider.AUDITORS).getName(each.getKey())
-                    .ifPresent(optional -> result.getAuditors().put(optional, 
algorithmSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlAlgorithmConfiguration.class))));
+                    .ifPresent(optional -> auditors.put(optional, 
YamlEngine.unmarshal(each.getValue(), YamlAlgorithmConfiguration.class)));
             if 
(shardingRuleNodePath.getUniqueItem(ShardingRuleNodePathProvider.DEFAULT_DATABASE_STRATEGY).isValidatedPath(each.getKey()))
 {
-                
result.setDefaultDatabaseShardingStrategy(shardingStrategySwapper.swapToObject(YamlEngine.unmarshal(each.getValue(),
 YamlShardingStrategyConfiguration.class)));
+                
yamlRuleConfig.setDefaultDatabaseStrategy(YamlEngine.unmarshal(each.getValue(), 
YamlShardingStrategyConfiguration.class));
             } else if 
(shardingRuleNodePath.getUniqueItem(ShardingRuleNodePathProvider.DEFAULT_TABLE_STRATEGY).isValidatedPath(each.getKey()))
 {
-                
result.setDefaultTableShardingStrategy(shardingStrategySwapper.swapToObject(YamlEngine.unmarshal(each.getValue(),
 YamlShardingStrategyConfiguration.class)));
+                
yamlRuleConfig.setDefaultTableStrategy(YamlEngine.unmarshal(each.getValue(), 
YamlShardingStrategyConfiguration.class));
             } else if 
(shardingRuleNodePath.getUniqueItem(ShardingRuleNodePathProvider.DEFAULT_KEY_GENERATE_STRATEGY).isValidatedPath(each.getKey()))
 {
-                
result.setDefaultKeyGenerateStrategy(keyGenerateStrategySwapper.swapToObject(YamlEngine.unmarshal(each.getValue(),
 YamlKeyGenerateStrategyConfiguration.class)));
+                
yamlRuleConfig.setDefaultKeyGenerateStrategy(YamlEngine.unmarshal(each.getValue(),
 YamlKeyGenerateStrategyConfiguration.class));
             } else if 
(shardingRuleNodePath.getUniqueItem(ShardingRuleNodePathProvider.DEFAULT_AUDIT_STRATEGY).isValidatedPath(each.getKey()))
 {
-                
result.setDefaultAuditStrategy(auditStrategySwapper.swapToObject(YamlEngine.unmarshal(each.getValue(),
 YamlShardingAuditStrategyConfiguration.class)));
+                
yamlRuleConfig.setDefaultAuditStrategy(YamlEngine.unmarshal(each.getValue(), 
YamlShardingAuditStrategyConfiguration.class));
             } else if 
(shardingRuleNodePath.getUniqueItem(ShardingRuleNodePathProvider.DEFAULT_SHARDING_COLUMN).isValidatedPath(each.getKey()))
 {
-                result.setDefaultShardingColumn(each.getValue());
+                yamlRuleConfig.setDefaultShardingColumn(each.getValue());
             } else if 
(shardingRuleNodePath.getUniqueItem(ShardingRuleNodePathProvider.SHARDING_CACHE).isValidatedPath(each.getKey()))
 {
-                
result.setShardingCache(shardingCacheSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(),
 YamlShardingCacheConfiguration.class)));
+                
yamlRuleConfig.setShardingCache(YamlEngine.unmarshal(each.getValue(), 
YamlShardingCacheConfiguration.class));
             }
         }
-        return Optional.of(result);
+        yamlRuleConfig.setTables(tables);
+        yamlRuleConfig.setAutoTables(autoTables);
+        yamlRuleConfig.setBindingTables(bindingTables);
+        yamlRuleConfig.setShardingAlgorithms(shardingAlgorithms);
+        yamlRuleConfig.setKeyGenerators(keyGenerators);
+        yamlRuleConfig.setAuditors(auditors);
+        return Optional.of(ruleConfigSwapper.swapToObject(yamlRuleConfig));
     }
     
     @Override
diff --git 
a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/yaml/swapper/AuthorityRuleConfigurationRepositoryTupleSwapper.java
 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/yaml/swapper/AuthorityRuleConfigurationRepositoryTupleSwapper.java
index 3a93769c62c..42ba53cdb78 100644
--- 
a/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/yaml/swapper/AuthorityRuleConfigurationRepositoryTupleSwapper.java
+++ 
b/kernel/authority/core/src/main/java/org/apache/shardingsphere/authority/yaml/swapper/AuthorityRuleConfigurationRepositoryTupleSwapper.java
@@ -19,67 +19,38 @@ package org.apache.shardingsphere.authority.yaml.swapper;
 
 import org.apache.shardingsphere.authority.config.AuthorityRuleConfiguration;
 import org.apache.shardingsphere.authority.constant.AuthorityOrder;
-import 
org.apache.shardingsphere.authority.rule.builder.DefaultAuthorityRuleConfigurationBuilder;
 import 
org.apache.shardingsphere.authority.yaml.config.YamlAuthorityRuleConfiguration;
-import 
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
-import 
org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfigurationSwapper;
 import org.apache.shardingsphere.infra.config.nodepath.GlobalNodePath;
-import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
 import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
 import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
 import org.apache.shardingsphere.mode.spi.RepositoryTupleSwapper;
 
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Map;
-import java.util.Map.Entry;
 import java.util.Optional;
-import java.util.stream.Collectors;
 
 /**
  * Authority rule configuration repository tuple swapper.
  */
 public final class AuthorityRuleConfigurationRepositoryTupleSwapper implements 
RepositoryTupleSwapper<AuthorityRuleConfiguration> {
     
-    private final YamlUserSwapper userSwapper = new YamlUserSwapper();
-    
-    private final YamlAlgorithmConfigurationSwapper algorithmSwapper = new 
YamlAlgorithmConfigurationSwapper();
+    private final YamlAuthorityRuleConfigurationSwapper ruleConfigSwapper = 
new YamlAuthorityRuleConfigurationSwapper();
     
     @Override
     public Collection<RepositoryTuple> swapToRepositoryTuples(final 
AuthorityRuleConfiguration data) {
-        return Collections.singleton(new 
RepositoryTuple(getRuleTagName().toLowerCase(), 
YamlEngine.marshal(swapToYamlConfiguration(data))));
-    }
-    
-    private YamlAuthorityRuleConfiguration swapToYamlConfiguration(final 
AuthorityRuleConfiguration data) {
-        YamlAuthorityRuleConfiguration result = new 
YamlAuthorityRuleConfiguration();
-        
result.setPrivilege(algorithmSwapper.swapToYamlConfiguration(data.getPrivilegeProvider()));
-        
result.setUsers(data.getUsers().stream().map(userSwapper::swapToYamlConfiguration).collect(Collectors.toList()));
-        result.setDefaultAuthenticator(data.getDefaultAuthenticator());
-        data.getAuthenticators().forEach((key, value) -> 
result.getAuthenticators().put(key, 
algorithmSwapper.swapToYamlConfiguration(value)));
-        return result;
+        return Collections.singleton(new 
RepositoryTuple(getRuleTagName().toLowerCase(), 
YamlEngine.marshal(ruleConfigSwapper.swapToYamlConfiguration(data))));
     }
     
     @Override
     public Optional<AuthorityRuleConfiguration> swapToObject(final 
Collection<RepositoryTuple> repositoryTuples) {
         for (RepositoryTuple each : repositoryTuples) {
             if (GlobalNodePath.getVersion(getRuleTagName().toLowerCase(), 
each.getKey()).isPresent()) {
-                return 
Optional.of(swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlAuthorityRuleConfiguration.class)));
+                return 
Optional.of(ruleConfigSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(),
 YamlAuthorityRuleConfiguration.class)));
             }
         }
         return Optional.empty();
     }
     
-    private AuthorityRuleConfiguration swapToObject(final 
YamlAuthorityRuleConfiguration yamlConfig) {
-        Collection<ShardingSphereUser> users = 
yamlConfig.getUsers().stream().map(userSwapper::swapToObject).collect(Collectors.toList());
-        AlgorithmConfiguration provider = 
algorithmSwapper.swapToObject(yamlConfig.getPrivilege());
-        if (null == provider) {
-            provider = new 
DefaultAuthorityRuleConfigurationBuilder().build().getPrivilegeProvider();
-        }
-        Map<String, AlgorithmConfiguration> authenticators = 
yamlConfig.getAuthenticators().entrySet().stream()
-                .collect(Collectors.toMap(Entry::getKey, entry -> 
algorithmSwapper.swapToObject(entry.getValue())));
-        return new AuthorityRuleConfiguration(users, provider, authenticators, 
yamlConfig.getDefaultAuthenticator());
-    }
-    
     @Override
     public Class<AuthorityRuleConfiguration> getTypeClass() {
         return AuthorityRuleConfiguration.class;
diff --git 
a/kernel/global-clock/core/src/main/java/org/apache/shardingsphere/globalclock/core/yaml/swapper/GlobalClockRuleConfigurationRepositoryTupleSwapper.java
 
b/kernel/global-clock/core/src/main/java/org/apache/shardingsphere/globalclock/core/yaml/swapper/GlobalClockRuleConfigurationRepositoryTupleSwapper.java
index ec722db3303..d3df9406a62 100644
--- 
a/kernel/global-clock/core/src/main/java/org/apache/shardingsphere/globalclock/core/yaml/swapper/GlobalClockRuleConfigurationRepositoryTupleSwapper.java
+++ 
b/kernel/global-clock/core/src/main/java/org/apache/shardingsphere/globalclock/core/yaml/swapper/GlobalClockRuleConfigurationRepositoryTupleSwapper.java
@@ -28,41 +28,29 @@ import 
org.apache.shardingsphere.mode.spi.RepositoryTupleSwapper;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Optional;
-import java.util.Properties;
 
 /**
  * Global clock rule configuration repository tuple swapper.
  */
 public final class GlobalClockRuleConfigurationRepositoryTupleSwapper 
implements RepositoryTupleSwapper<GlobalClockRuleConfiguration> {
     
+    private final YamlGlobalClockRuleConfigurationSwapper ruleConfigSwapper = 
new YamlGlobalClockRuleConfigurationSwapper();
+    
     @Override
     public Collection<RepositoryTuple> swapToRepositoryTuples(final 
GlobalClockRuleConfiguration data) {
-        return Collections.singleton(new 
RepositoryTuple(getRuleTagName().toLowerCase(), 
YamlEngine.marshal(swapToYamlConfiguration(data))));
-    }
-    
-    private YamlGlobalClockRuleConfiguration swapToYamlConfiguration(final 
GlobalClockRuleConfiguration data) {
-        YamlGlobalClockRuleConfiguration result = new 
YamlGlobalClockRuleConfiguration();
-        result.setType(data.getType());
-        result.setProvider(data.getProvider());
-        result.setEnabled(data.isEnabled());
-        result.setProps(data.getProps());
-        return result;
+        return Collections.singleton(new 
RepositoryTuple(getRuleTagName().toLowerCase(), 
YamlEngine.marshal(ruleConfigSwapper.swapToYamlConfiguration(data))));
     }
     
     @Override
     public Optional<GlobalClockRuleConfiguration> swapToObject(final 
Collection<RepositoryTuple> repositoryTuples) {
         for (RepositoryTuple each : repositoryTuples) {
             if (GlobalNodePath.getVersion(getRuleTagName().toLowerCase(), 
each.getKey()).isPresent()) {
-                return 
Optional.of(swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlGlobalClockRuleConfiguration.class)));
+                return 
Optional.of(ruleConfigSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(),
 YamlGlobalClockRuleConfiguration.class)));
             }
         }
         return Optional.empty();
     }
     
-    private GlobalClockRuleConfiguration swapToObject(final 
YamlGlobalClockRuleConfiguration yamlConfig) {
-        return new GlobalClockRuleConfiguration(yamlConfig.getType(), 
yamlConfig.getProvider(), yamlConfig.isEnabled(), null == yamlConfig.getProps() 
? new Properties() : yamlConfig.getProps());
-    }
-    
     @Override
     public String getRuleTagName() {
         return "GLOBAL_CLOCK";
diff --git 
a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/swapper/LoggingRuleConfigurationRepositoryTupleSwapper.java
 
b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/swapper/LoggingRuleConfigurationRepositoryTupleSwapper.java
index 8bf61b1f04e..264fea59d48 100644
--- 
a/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/swapper/LoggingRuleConfigurationRepositoryTupleSwapper.java
+++ 
b/kernel/logging/core/src/main/java/org/apache/shardingsphere/logging/yaml/swapper/LoggingRuleConfigurationRepositoryTupleSwapper.java
@@ -20,13 +20,10 @@ package org.apache.shardingsphere.logging.yaml.swapper;
 import org.apache.shardingsphere.infra.config.nodepath.GlobalNodePath;
 import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
 import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
-import org.apache.shardingsphere.mode.spi.RepositoryTupleSwapper;
 import org.apache.shardingsphere.logging.config.LoggingRuleConfiguration;
 import org.apache.shardingsphere.logging.constant.LoggingOrder;
-import 
org.apache.shardingsphere.logging.rule.builder.DefaultLoggingRuleConfigurationBuilder;
-import 
org.apache.shardingsphere.logging.yaml.config.YamlAppendersConfigurationConverter;
-import 
org.apache.shardingsphere.logging.yaml.config.YamlLoggersConfigurationConverter;
 import 
org.apache.shardingsphere.logging.yaml.config.YamlLoggingRuleConfiguration;
+import org.apache.shardingsphere.mode.spi.RepositoryTupleSwapper;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -37,41 +34,23 @@ import java.util.Optional;
  */
 public final class LoggingRuleConfigurationRepositoryTupleSwapper implements 
RepositoryTupleSwapper<LoggingRuleConfiguration> {
     
+    private final YamlLoggingRuleConfigurationSwapper ruleConfigSwapper = new 
YamlLoggingRuleConfigurationSwapper();
+    
     @Override
     public Collection<RepositoryTuple> swapToRepositoryTuples(final 
LoggingRuleConfiguration data) {
-        return Collections.singleton(new 
RepositoryTuple(getRuleTagName().toLowerCase(), 
YamlEngine.marshal(swapToYamlConfiguration(data))));
-    }
-    
-    private YamlLoggingRuleConfiguration swapToYamlConfiguration(final 
LoggingRuleConfiguration data) {
-        YamlLoggingRuleConfiguration result = new 
YamlLoggingRuleConfiguration();
-        
result.setLoggers(YamlLoggersConfigurationConverter.convertYamlLoggerConfigurations(data.getLoggers()));
-        
result.setAppenders(YamlAppendersConfigurationConverter.convertYamlAppenderConfigurations(data.getAppenders()));
-        return result;
+        return Collections.singleton(new 
RepositoryTuple(getRuleTagName().toLowerCase(), 
YamlEngine.marshal(ruleConfigSwapper.swapToYamlConfiguration(data))));
     }
     
     @Override
     public Optional<LoggingRuleConfiguration> swapToObject(final 
Collection<RepositoryTuple> repositoryTuples) {
         for (RepositoryTuple each : repositoryTuples) {
             if (GlobalNodePath.getVersion(getRuleTagName().toLowerCase(), 
each.getKey()).isPresent()) {
-                return 
Optional.of(swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlLoggingRuleConfiguration.class)));
+                return 
Optional.of(ruleConfigSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(),
 YamlLoggingRuleConfiguration.class)));
             }
         }
         return Optional.empty();
     }
     
-    private LoggingRuleConfiguration swapToObject(final 
YamlLoggingRuleConfiguration yamlConfig) {
-        LoggingRuleConfiguration result = new 
LoggingRuleConfiguration(YamlLoggersConfigurationConverter.convertShardingSphereLogger(yamlConfig.getLoggers()),
-                
YamlAppendersConfigurationConverter.convertShardingSphereAppender(yamlConfig.getAppenders()));
-        if (null == result.getLoggers()) {
-            result = getDefaultLoggingRuleConfiguration();
-        }
-        return result;
-    }
-    
-    private LoggingRuleConfiguration getDefaultLoggingRuleConfiguration() {
-        return new DefaultLoggingRuleConfigurationBuilder().build();
-    }
-    
     @Override
     public Class<LoggingRuleConfiguration> getTypeClass() {
         return LoggingRuleConfiguration.class;
diff --git 
a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/yaml/config/swapper/SingleRuleConfigurationRepositoryTupleSwapper.java
 
b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/yaml/config/swapper/SingleRuleConfigurationRepositoryTupleSwapper.java
index 503d6a337a7..9d6025d0746 100644
--- 
a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/yaml/config/swapper/SingleRuleConfigurationRepositoryTupleSwapper.java
+++ 
b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/yaml/config/swapper/SingleRuleConfigurationRepositoryTupleSwapper.java
@@ -36,37 +36,25 @@ import java.util.stream.Collectors;
  */
 public final class SingleRuleConfigurationRepositoryTupleSwapper implements 
RepositoryTupleSwapper<SingleRuleConfiguration> {
     
+    private final YamlSingleRuleConfigurationSwapper ruleConfigSwapper = new 
YamlSingleRuleConfigurationSwapper();
+    
     private final RuleNodePath singleRuleNodePath = new 
SingleRuleNodePathProvider().getRuleNodePath();
     
     @Override
     public Collection<RepositoryTuple> swapToRepositoryTuples(final 
SingleRuleConfiguration data) {
-        return Collections.singletonList(new 
RepositoryTuple(SingleRuleNodePathProvider.TABLES, 
YamlEngine.marshal(swapToYamlConfiguration(data))));
-    }
-    
-    private YamlSingleRuleConfiguration swapToYamlConfiguration(final 
SingleRuleConfiguration data) {
-        YamlSingleRuleConfiguration result = new YamlSingleRuleConfiguration();
-        result.getTables().addAll(data.getTables());
-        data.getDefaultDataSource().ifPresent(result::setDefaultDataSource);
-        return result;
+        return Collections.singleton(new 
RepositoryTuple(SingleRuleNodePathProvider.TABLES, 
YamlEngine.marshal(ruleConfigSwapper.swapToYamlConfiguration(data))));
     }
     
     @Override
     public Optional<SingleRuleConfiguration> swapToObject(final 
Collection<RepositoryTuple> repositoryTuples) {
         for (RepositoryTuple each : repositoryTuples.stream().filter(each -> 
singleRuleNodePath.getRoot().isValidatedPath(each.getKey())).collect(Collectors.toList()))
 {
             if 
(singleRuleNodePath.getUniqueItem(SingleRuleNodePathProvider.TABLES).isValidatedPath(each.getKey()))
 {
-                return 
Optional.of(swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlSingleRuleConfiguration.class)));
+                return 
Optional.of(ruleConfigSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(),
 YamlSingleRuleConfiguration.class)));
             }
         }
         return Optional.empty();
     }
     
-    private SingleRuleConfiguration swapToObject(final 
YamlSingleRuleConfiguration yamlConfig) {
-        SingleRuleConfiguration result = new SingleRuleConfiguration();
-        result.getTables().addAll(yamlConfig.getTables());
-        result.setDefaultDataSource(yamlConfig.getDefaultDataSource());
-        return result;
-    }
-    
     @Override
     public Class<SingleRuleConfiguration> getTypeClass() {
         return SingleRuleConfiguration.class;
diff --git 
a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/yaml/swapper/SQLFederationRuleConfigurationRepositoryTupleSwapper.java
 
b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/yaml/swapper/SQLFederationRuleConfigurationRepositoryTupleSwapper.java
index e651ee170b1..ec39abf7f40 100644
--- 
a/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/yaml/swapper/SQLFederationRuleConfigurationRepositoryTupleSwapper.java
+++ 
b/kernel/sql-federation/core/src/main/java/org/apache/shardingsphere/sqlfederation/yaml/swapper/SQLFederationRuleConfigurationRepositoryTupleSwapper.java
@@ -21,7 +21,6 @@ import 
org.apache.shardingsphere.infra.config.nodepath.GlobalNodePath;
 import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
 import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
 import org.apache.shardingsphere.mode.spi.RepositoryTupleSwapper;
-import org.apache.shardingsphere.sql.parser.api.CacheOption;
 import 
org.apache.shardingsphere.sqlfederation.api.config.SQLFederationRuleConfiguration;
 import org.apache.shardingsphere.sqlfederation.constant.SQLFederationOrder;
 import 
org.apache.shardingsphere.sqlfederation.yaml.config.YamlSQLFederationRuleConfiguration;
@@ -35,36 +34,23 @@ import java.util.Optional;
  */
 public final class SQLFederationRuleConfigurationRepositoryTupleSwapper 
implements RepositoryTupleSwapper<SQLFederationRuleConfiguration> {
     
-    private final YamlSQLFederationExecutionPlanCacheConfigurationSwapper 
executionPlanCacheConfigSwapper = new 
YamlSQLFederationExecutionPlanCacheConfigurationSwapper();
+    private final YamlSQLFederationRuleConfigurationSwapper ruleConfigSwapper 
= new YamlSQLFederationRuleConfigurationSwapper();
     
     @Override
     public Collection<RepositoryTuple> swapToRepositoryTuples(final 
SQLFederationRuleConfiguration data) {
-        return Collections.singleton(new 
RepositoryTuple(getRuleTagName().toLowerCase(), 
YamlEngine.marshal(swapToYamlConfiguration(data))));
-    }
-    
-    private YamlSQLFederationRuleConfiguration swapToYamlConfiguration(final 
SQLFederationRuleConfiguration data) {
-        YamlSQLFederationRuleConfiguration result = new 
YamlSQLFederationRuleConfiguration();
-        result.setSqlFederationEnabled(data.isSqlFederationEnabled());
-        result.setAllQueryUseSQLFederation(data.isAllQueryUseSQLFederation());
-        
result.setExecutionPlanCache(executionPlanCacheConfigSwapper.swapToYamlConfiguration(data.getExecutionPlanCache()));
-        return result;
+        return Collections.singleton(new 
RepositoryTuple(getRuleTagName().toLowerCase(), 
YamlEngine.marshal(ruleConfigSwapper.swapToYamlConfiguration(data))));
     }
     
     @Override
     public Optional<SQLFederationRuleConfiguration> swapToObject(final 
Collection<RepositoryTuple> repositoryTuples) {
         for (RepositoryTuple each : repositoryTuples) {
             if (GlobalNodePath.getVersion(getRuleTagName().toLowerCase(), 
each.getKey()).isPresent()) {
-                return 
Optional.of(swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlSQLFederationRuleConfiguration.class)));
+                return 
Optional.of(ruleConfigSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(),
 YamlSQLFederationRuleConfiguration.class)));
             }
         }
         return Optional.empty();
     }
     
-    private SQLFederationRuleConfiguration swapToObject(final 
YamlSQLFederationRuleConfiguration yamlConfig) {
-        CacheOption executionPlanCacheConfig = 
executionPlanCacheConfigSwapper.swapToObject(yamlConfig.getExecutionPlanCache());
-        return new 
SQLFederationRuleConfiguration(yamlConfig.isSqlFederationEnabled(), 
yamlConfig.isAllQueryUseSQLFederation(), executionPlanCacheConfig);
-    }
-    
     @Override
     public Class<SQLFederationRuleConfiguration> getTypeClass() {
         return SQLFederationRuleConfiguration.class;
diff --git 
a/kernel/sql-parser/core/src/main/java/org/apache/shardingsphere/parser/yaml/swapper/SQLParserRuleConfigurationRepositoryTupleSwapper.java
 
b/kernel/sql-parser/core/src/main/java/org/apache/shardingsphere/parser/yaml/swapper/SQLParserRuleConfigurationRepositoryTupleSwapper.java
index 30a271ad897..e83ee0803e7 100644
--- 
a/kernel/sql-parser/core/src/main/java/org/apache/shardingsphere/parser/yaml/swapper/SQLParserRuleConfigurationRepositoryTupleSwapper.java
+++ 
b/kernel/sql-parser/core/src/main/java/org/apache/shardingsphere/parser/yaml/swapper/SQLParserRuleConfigurationRepositoryTupleSwapper.java
@@ -23,9 +23,7 @@ import 
org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
 import org.apache.shardingsphere.mode.spi.RepositoryTupleSwapper;
 import org.apache.shardingsphere.parser.config.SQLParserRuleConfiguration;
 import org.apache.shardingsphere.parser.constant.SQLParserOrder;
-import 
org.apache.shardingsphere.parser.rule.builder.DefaultSQLParserRuleConfigurationBuilder;
 import 
org.apache.shardingsphere.parser.yaml.config.YamlSQLParserRuleConfiguration;
-import org.apache.shardingsphere.sql.parser.api.CacheOption;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -36,40 +34,23 @@ import java.util.Optional;
  */
 public final class SQLParserRuleConfigurationRepositoryTupleSwapper implements 
RepositoryTupleSwapper<SQLParserRuleConfiguration> {
     
-    private final YamlSQLParserCacheOptionConfigurationSwapper 
cacheOptionSwapper = new YamlSQLParserCacheOptionConfigurationSwapper();
+    private final YamlSQLParserRuleConfigurationSwapper ruleConfigSwapper = 
new YamlSQLParserRuleConfigurationSwapper();
     
     @Override
     public Collection<RepositoryTuple> swapToRepositoryTuples(final 
SQLParserRuleConfiguration data) {
-        return Collections.singleton(new 
RepositoryTuple(getRuleTagName().toLowerCase(), 
YamlEngine.marshal(swapToYamlConfiguration(data))));
-    }
-    
-    private YamlSQLParserRuleConfiguration swapToYamlConfiguration(final 
SQLParserRuleConfiguration data) {
-        YamlSQLParserRuleConfiguration result = new 
YamlSQLParserRuleConfiguration();
-        
result.setParseTreeCache(cacheOptionSwapper.swapToYamlConfiguration(data.getParseTreeCache()));
-        
result.setSqlStatementCache(cacheOptionSwapper.swapToYamlConfiguration(data.getSqlStatementCache()));
-        return result;
+        return Collections.singleton(new 
RepositoryTuple(getRuleTagName().toLowerCase(), 
YamlEngine.marshal(ruleConfigSwapper.swapToYamlConfiguration(data))));
     }
     
     @Override
     public Optional<SQLParserRuleConfiguration> swapToObject(final 
Collection<RepositoryTuple> repositoryTuples) {
         for (RepositoryTuple each : repositoryTuples) {
             if (GlobalNodePath.getVersion(getRuleTagName().toLowerCase(), 
each.getKey()).isPresent()) {
-                return 
Optional.of(swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlSQLParserRuleConfiguration.class)));
+                return 
Optional.of(ruleConfigSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(),
 YamlSQLParserRuleConfiguration.class)));
             }
         }
         return Optional.empty();
     }
     
-    private SQLParserRuleConfiguration swapToObject(final 
YamlSQLParserRuleConfiguration yamlConfig) {
-        CacheOption parseTreeCacheOption = null == 
yamlConfig.getParseTreeCache()
-                ? 
DefaultSQLParserRuleConfigurationBuilder.PARSE_TREE_CACHE_OPTION
-                : 
cacheOptionSwapper.swapToObject(yamlConfig.getParseTreeCache());
-        CacheOption sqlStatementCacheOption = null == 
yamlConfig.getSqlStatementCache()
-                ? 
DefaultSQLParserRuleConfigurationBuilder.SQL_STATEMENT_CACHE_OPTION
-                : 
cacheOptionSwapper.swapToObject(yamlConfig.getSqlStatementCache());
-        return new SQLParserRuleConfiguration(parseTreeCacheOption, 
sqlStatementCacheOption);
-    }
-    
     @Override
     public Class<SQLParserRuleConfiguration> getTypeClass() {
         return SQLParserRuleConfiguration.class;
diff --git 
a/kernel/sql-translator/core/src/main/java/org/apache/shardingsphere/sqltranslator/yaml/swapper/SQLTranslatorRuleConfigurationRepositoryTupleSwapper.java
 
b/kernel/sql-translator/core/src/main/java/org/apache/shardingsphere/sqltranslator/yaml/swapper/SQLTranslatorRuleConfigurationRepositoryTupleSwapper.java
index 22e0674af28..e0fcf6a8856 100644
--- 
a/kernel/sql-translator/core/src/main/java/org/apache/shardingsphere/sqltranslator/yaml/swapper/SQLTranslatorRuleConfigurationRepositoryTupleSwapper.java
+++ 
b/kernel/sql-translator/core/src/main/java/org/apache/shardingsphere/sqltranslator/yaml/swapper/SQLTranslatorRuleConfigurationRepositoryTupleSwapper.java
@@ -34,33 +34,23 @@ import java.util.Optional;
  */
 public final class SQLTranslatorRuleConfigurationRepositoryTupleSwapper 
implements RepositoryTupleSwapper<SQLTranslatorRuleConfiguration> {
     
+    private final YamlSQLTranslatorRuleConfigurationSwapper ruleConfigSwapper 
= new YamlSQLTranslatorRuleConfigurationSwapper();
+    
     @Override
     public Collection<RepositoryTuple> swapToRepositoryTuples(final 
SQLTranslatorRuleConfiguration data) {
-        return Collections.singleton(new 
RepositoryTuple(getRuleTagName().toLowerCase(), 
YamlEngine.marshal(swapToYamlConfiguration(data))));
-    }
-    
-    private YamlSQLTranslatorRuleConfiguration swapToYamlConfiguration(final 
SQLTranslatorRuleConfiguration data) {
-        YamlSQLTranslatorRuleConfiguration result = new 
YamlSQLTranslatorRuleConfiguration();
-        result.setType(data.getType());
-        result.setProps(data.getProps());
-        
result.setUseOriginalSQLWhenTranslatingFailed(data.isUseOriginalSQLWhenTranslatingFailed());
-        return result;
+        return Collections.singleton(new 
RepositoryTuple(getRuleTagName().toLowerCase(), 
YamlEngine.marshal(ruleConfigSwapper.swapToYamlConfiguration(data))));
     }
     
     @Override
     public Optional<SQLTranslatorRuleConfiguration> swapToObject(final 
Collection<RepositoryTuple> repositoryTuples) {
         for (RepositoryTuple each : repositoryTuples) {
             if (GlobalNodePath.getVersion(getRuleTagName().toLowerCase(), 
each.getKey()).isPresent()) {
-                return 
Optional.of(swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlSQLTranslatorRuleConfiguration.class)));
+                return 
Optional.of(ruleConfigSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(),
 YamlSQLTranslatorRuleConfiguration.class)));
             }
         }
         return Optional.empty();
     }
     
-    private SQLTranslatorRuleConfiguration swapToObject(final 
YamlSQLTranslatorRuleConfiguration yamlConfig) {
-        return new SQLTranslatorRuleConfiguration(yamlConfig.getType(), 
yamlConfig.getProps(), yamlConfig.isUseOriginalSQLWhenTranslatingFailed());
-    }
-    
     @Override
     public Class<SQLTranslatorRuleConfiguration> getTypeClass() {
         return SQLTranslatorRuleConfiguration.class;
diff --git 
a/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/yaml/swapper/TrafficRuleConfigurationRepositoryTupleSwapper.java
 
b/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/yaml/swapper/TrafficRuleConfigurationRepositoryTupleSwapper.java
index d09af570565..1d5a6dd1a34 100644
--- 
a/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/yaml/swapper/TrafficRuleConfigurationRepositoryTupleSwapper.java
+++ 
b/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/yaml/swapper/TrafficRuleConfigurationRepositoryTupleSwapper.java
@@ -17,7 +17,6 @@
 
 package org.apache.shardingsphere.traffic.yaml.swapper;
 
-import 
org.apache.shardingsphere.infra.algorithm.core.yaml.YamlAlgorithmConfigurationSwapper;
 import org.apache.shardingsphere.infra.config.nodepath.GlobalNodePath;
 import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
 import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
@@ -25,11 +24,9 @@ import 
org.apache.shardingsphere.mode.spi.RepositoryTupleSwapper;
 import org.apache.shardingsphere.traffic.api.config.TrafficRuleConfiguration;
 import org.apache.shardingsphere.traffic.constant.TrafficOrder;
 import 
org.apache.shardingsphere.traffic.yaml.config.YamlTrafficRuleConfiguration;
-import 
org.apache.shardingsphere.traffic.yaml.config.YamlTrafficStrategyConfiguration;
 
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Map.Entry;
 import java.util.Optional;
 
 /**
@@ -37,62 +34,23 @@ import java.util.Optional;
  */
 public final class TrafficRuleConfigurationRepositoryTupleSwapper implements 
RepositoryTupleSwapper<TrafficRuleConfiguration> {
     
-    private final YamlTrafficStrategyConfigurationSwapper strategySwapper = 
new YamlTrafficStrategyConfigurationSwapper();
-    
-    private final YamlAlgorithmConfigurationSwapper algorithmSwapper = new 
YamlAlgorithmConfigurationSwapper();
+    private final YamlTrafficRuleConfigurationSwapper ruleConfigSwapper = new 
YamlTrafficRuleConfigurationSwapper();
     
     @Override
     public Collection<RepositoryTuple> swapToRepositoryTuples(final 
TrafficRuleConfiguration data) {
-        return Collections.singleton(new 
RepositoryTuple(getRuleTagName().toLowerCase(), 
YamlEngine.marshal(swapToYamlConfiguration(data))));
-    }
-    
-    private YamlTrafficRuleConfiguration swapToYamlConfiguration(final 
TrafficRuleConfiguration data) {
-        YamlTrafficRuleConfiguration result = new 
YamlTrafficRuleConfiguration();
-        data.getTrafficStrategies().forEach(each -> 
result.getTrafficStrategies().put(each.getName(), 
strategySwapper.swapToYamlConfiguration(each)));
-        setYamlAlgorithms(data, result);
-        return result;
-    }
-    
-    private void setYamlAlgorithms(final TrafficRuleConfiguration data, final 
YamlTrafficRuleConfiguration yamlConfig) {
-        if (null != data.getTrafficAlgorithms()) {
-            data.getTrafficAlgorithms().forEach((key, value) -> 
yamlConfig.getTrafficAlgorithms().put(key, 
algorithmSwapper.swapToYamlConfiguration(value)));
-        }
-        if (null != data.getLoadBalancers()) {
-            data.getLoadBalancers().forEach((key, value) -> 
yamlConfig.getLoadBalancers().put(key, 
algorithmSwapper.swapToYamlConfiguration(value)));
-        }
+        return Collections.singleton(new 
RepositoryTuple(getRuleTagName().toLowerCase(), 
YamlEngine.marshal(ruleConfigSwapper.swapToYamlConfiguration(data))));
     }
     
     @Override
     public Optional<TrafficRuleConfiguration> swapToObject(final 
Collection<RepositoryTuple> repositoryTuples) {
         for (RepositoryTuple each : repositoryTuples) {
             if (GlobalNodePath.getVersion(getRuleTagName().toLowerCase(), 
each.getKey()).isPresent()) {
-                return 
Optional.of(swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlTrafficRuleConfiguration.class)));
+                return 
Optional.of(ruleConfigSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(),
 YamlTrafficRuleConfiguration.class)));
             }
         }
         return Optional.empty();
     }
     
-    private TrafficRuleConfiguration swapToObject(final 
YamlTrafficRuleConfiguration yamlConfig) {
-        
-        TrafficRuleConfiguration result = new TrafficRuleConfiguration();
-        for (Entry<String, YamlTrafficStrategyConfiguration> entry : 
yamlConfig.getTrafficStrategies().entrySet()) {
-            YamlTrafficStrategyConfiguration strategyConfig = entry.getValue();
-            strategyConfig.setName(entry.getKey());
-            
result.getTrafficStrategies().add(strategySwapper.swapToObject(strategyConfig));
-        }
-        setAlgorithms(yamlConfig, result);
-        return result;
-    }
-    
-    private void setAlgorithms(final YamlTrafficRuleConfiguration yamlConfig, 
final TrafficRuleConfiguration ruleConfig) {
-        if (null != yamlConfig.getTrafficAlgorithms()) {
-            yamlConfig.getTrafficAlgorithms().forEach((key, value) -> 
ruleConfig.getTrafficAlgorithms().put(key, 
algorithmSwapper.swapToObject(value)));
-        }
-        if (null != yamlConfig.getLoadBalancers()) {
-            yamlConfig.getLoadBalancers().forEach((key, value) -> 
ruleConfig.getLoadBalancers().put(key, algorithmSwapper.swapToObject(value)));
-        }
-    }
-    
     @Override
     public Class<TrafficRuleConfiguration> getTypeClass() {
         return TrafficRuleConfiguration.class;
diff --git 
a/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/yaml/swapper/TransactionRuleConfigurationRepositoryTupleSwapper.java
 
b/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/yaml/swapper/TransactionRuleConfigurationRepositoryTupleSwapper.java
index 293c9bfaeaa..0745afda4ca 100644
--- 
a/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/yaml/swapper/TransactionRuleConfigurationRepositoryTupleSwapper.java
+++ 
b/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/yaml/swapper/TransactionRuleConfigurationRepositoryTupleSwapper.java
@@ -28,40 +28,29 @@ import 
org.apache.shardingsphere.transaction.yaml.config.YamlTransactionRuleConf
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Optional;
-import java.util.Properties;
 
 /**
  * Transaction rule configuration repository tuple swapper.
  */
 public final class TransactionRuleConfigurationRepositoryTupleSwapper 
implements RepositoryTupleSwapper<TransactionRuleConfiguration> {
     
+    private final YamlTransactionRuleConfigurationSwapper ruleConfigSwapper = 
new YamlTransactionRuleConfigurationSwapper();
+    
     @Override
     public Collection<RepositoryTuple> swapToRepositoryTuples(final 
TransactionRuleConfiguration data) {
-        return Collections.singleton(new 
RepositoryTuple(getRuleTagName().toLowerCase(), 
YamlEngine.marshal(swapToYamlConfiguration(data))));
-    }
-    
-    private YamlTransactionRuleConfiguration swapToYamlConfiguration(final 
TransactionRuleConfiguration data) {
-        YamlTransactionRuleConfiguration result = new 
YamlTransactionRuleConfiguration();
-        result.setDefaultType(data.getDefaultType());
-        result.setProviderType(data.getProviderType());
-        result.setProps(data.getProps());
-        return result;
+        return Collections.singleton(new 
RepositoryTuple(getRuleTagName().toLowerCase(), 
YamlEngine.marshal(ruleConfigSwapper.swapToYamlConfiguration(data))));
     }
     
     @Override
     public Optional<TransactionRuleConfiguration> swapToObject(final 
Collection<RepositoryTuple> repositoryTuples) {
         for (RepositoryTuple each : repositoryTuples) {
             if (GlobalNodePath.getVersion(getRuleTagName().toLowerCase(), 
each.getKey()).isPresent()) {
-                return 
Optional.of(swapToObject(YamlEngine.unmarshal(each.getValue(), 
YamlTransactionRuleConfiguration.class)));
+                return 
Optional.of(ruleConfigSwapper.swapToObject(YamlEngine.unmarshal(each.getValue(),
 YamlTransactionRuleConfiguration.class)));
             }
         }
         return Optional.empty();
     }
     
-    private TransactionRuleConfiguration swapToObject(final 
YamlTransactionRuleConfiguration yamlConfig) {
-        return new TransactionRuleConfiguration(yamlConfig.getDefaultType(), 
yamlConfig.getProviderType(), null == yamlConfig.getProps() ? new Properties() 
: yamlConfig.getProps());
-    }
-    
     @Override
     public Class<TransactionRuleConfiguration> getTypeClass() {
         return TransactionRuleConfiguration.class;
diff --git 
a/mode/api/src/main/java/org/apache/shardingsphere/mode/spi/RepositoryTupleSwapper.java
 
b/mode/api/src/main/java/org/apache/shardingsphere/mode/spi/RepositoryTupleSwapper.java
index f7e7a07a0ca..72ef85cdf20 100644
--- 
a/mode/api/src/main/java/org/apache/shardingsphere/mode/spi/RepositoryTupleSwapper.java
+++ 
b/mode/api/src/main/java/org/apache/shardingsphere/mode/spi/RepositoryTupleSwapper.java
@@ -17,6 +17,7 @@
 
 package org.apache.shardingsphere.mode.spi;
 
+import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
 import org.apache.shardingsphere.infra.spi.annotation.SingletonSPI;
 import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPI;
 import org.apache.shardingsphere.infra.util.yaml.datanode.RepositoryTuple;
@@ -30,7 +31,7 @@ import java.util.Optional;
  * @param <T> type of swapped object
  */
 @SingletonSPI
-public interface RepositoryTupleSwapper<T> extends OrderedSPI<T> {
+public interface RepositoryTupleSwapper<T extends RuleConfiguration> extends 
OrderedSPI<T> {
     
     /**
     * Swap to repository tuples.


Reply via email to