You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2022/10/27 00:21:06 UTC
[shardingsphere] branch master updated: refactor code. (#21779)
This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 261cd9eaeef refactor code. (#21779)
261cd9eaeef is described below
commit 261cd9eaeef7719e36c6aa4a94fe5d44ebd25796
Author: Zonglei Dong <do...@apache.org>
AuthorDate: Thu Oct 27 08:21:00 2022 +0800
refactor code. (#21779)
---
.../shardingsphere/infra/hint/SQLHintExtractor.java | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/hint/SQLHintExtractor.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/hint/SQLHintExtractor.java
index 7db4fc4328a..f5802136d9d 100644
--- a/infra/common/src/main/java/org/apache/shardingsphere/infra/hint/SQLHintExtractor.java
+++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/hint/SQLHintExtractor.java
@@ -24,6 +24,7 @@ import org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStat
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
import java.util.Collection;
+import java.util.Objects;
import java.util.Properties;
/**
@@ -88,12 +89,7 @@ public final class SQLHintExtractor {
Object result = sqlHintProperties.getProps().containsKey(key)
? sqlHintProperties.getProps().get(key)
: sqlHintProperties.getProps().get(SQLHintPropertiesKey.SHARDING_DATABASE_VALUE_KEY.getKey());
- if (result instanceof Comparable) {
- return (Comparable<?>) result;
- }
- return sqlHintProperties.getProps().containsKey(key)
- ? sqlHintProperties.getProps().getProperty(key)
- : sqlHintProperties.getValue(SQLHintPropertiesKey.SHARDING_DATABASE_VALUE_KEY);
+ return result instanceof Comparable ? (Comparable<?>) result : Objects.toString(result);
}
/**
@@ -118,12 +114,7 @@ public final class SQLHintExtractor {
Object result = sqlHintProperties.getProps().containsKey(key)
? sqlHintProperties.getProps().get(key)
: sqlHintProperties.getProps().get(SQLHintPropertiesKey.SHARDING_TABLE_VALUE_KEY.getKey());
- if (result instanceof Comparable) {
- return (Comparable<?>) result;
- }
- return sqlHintProperties.getProps().containsKey(key)
- ? sqlHintProperties.getProps().getProperty(key)
- : sqlHintProperties.getValue(SQLHintPropertiesKey.SHARDING_TABLE_VALUE_KEY);
+ return result instanceof Comparable ? (Comparable<?>) result : Objects.toString(result);
}
/**