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

panjuan 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 81df69bd18e Merge PropertiesConverter and LocalDataQueryResultRow 
(#30111)
81df69bd18e is described below

commit 81df69bd18ee951994196cd1dc54a0ccfa6cd4db
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Feb 13 20:56:08 2024 +0800

    Merge PropertiesConverter and LocalDataQueryResultRow (#30111)
---
 .../infra/props/PropertiesConverter.java           | 45 ----------------------
 .../result/impl/local/LocalDataQueryResultRow.java | 10 ++++-
 2 files changed, 8 insertions(+), 47 deletions(-)

diff --git 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/props/PropertiesConverter.java
 
b/infra/common/src/main/java/org/apache/shardingsphere/infra/props/PropertiesConverter.java
deleted file mode 100644
index ed49c35ef07..00000000000
--- 
a/infra/common/src/main/java/org/apache/shardingsphere/infra/props/PropertiesConverter.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.props;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.infra.util.json.JsonUtils;
-
-import java.util.LinkedHashMap;
-import java.util.Properties;
-import java.util.stream.Collectors;
-
-/**
- * Properties converter.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class PropertiesConverter {
-    
-    /**
-     * Convert properties to string content.
-     * 
-     * @param props properties to be converted
-     * @return converted string content
-     */
-    public static String convert(final Properties props) {
-        return null == props || props.isEmpty() ? ""
-                : 
JsonUtils.toJsonString(props.keySet().stream().map(Object::toString).sorted()
-                        .collect(Collectors.toMap(each -> each, props::get, 
(oldValue, currentValue) -> oldValue, LinkedHashMap::new)));
-    }
-}
diff --git 
a/infra/merge/src/main/java/org/apache/shardingsphere/infra/merge/result/impl/local/LocalDataQueryResultRow.java
 
b/infra/merge/src/main/java/org/apache/shardingsphere/infra/merge/result/impl/local/LocalDataQueryResultRow.java
index 90a302af8ac..0178b3393c1 100644
--- 
a/infra/merge/src/main/java/org/apache/shardingsphere/infra/merge/result/impl/local/LocalDataQueryResultRow.java
+++ 
b/infra/merge/src/main/java/org/apache/shardingsphere/infra/merge/result/impl/local/LocalDataQueryResultRow.java
@@ -18,9 +18,11 @@
 package org.apache.shardingsphere.infra.merge.result.impl.local;
 
 import com.google.common.base.Preconditions;
-import org.apache.shardingsphere.infra.props.PropertiesConverter;
+import org.apache.shardingsphere.infra.util.json.JsonUtils;
 
+import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Properties;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -47,11 +49,15 @@ public final class LocalDataQueryResultRow {
             return ((Enum<?>) data).name();
         }
         if (data instanceof Properties) {
-            return PropertiesConverter.convert((Properties) data);
+            return ((Properties) data).isEmpty() ? "" : 
JsonUtils.toJsonString(convert((Properties) data));
         }
         return data;
     }
     
+    private Map<Object, Object> convert(final Properties props) {
+        return 
props.keySet().stream().map(Object::toString).sorted().collect(Collectors.toMap(each
 -> each, props::get, (oldValue, currentValue) -> oldValue, 
LinkedHashMap::new));
+    }
+    
     /**
      * Get data from cell.
      * 

Reply via email to