You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2021/08/11 12:36:16 UTC
[shardingsphere] branch master updated: Refactor Column (#11760)
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 e14b4f2 Refactor Column (#11760)
e14b4f2 is described below
commit e14b4f272d2d76430435a2f33180fc8ec5293a2b
Author: 吴伟杰 <wu...@apache.org>
AuthorDate: Wed Aug 11 20:35:47 2021 +0800
Refactor Column (#11760)
---
.../sharding/route/engine/condition/Column.java | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/Column.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/Column.java
index 63d4776..5d2afe5 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/Column.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/Column.java
@@ -17,15 +17,14 @@
package org.apache.shardingsphere.sharding.route.engine.condition;
-import com.google.common.base.Objects;
import lombok.Getter;
-import lombok.RequiredArgsConstructor;
import lombok.ToString;
+import java.util.Objects;
+
/**
* Column.
*/
-@RequiredArgsConstructor
@Getter
@ToString
public final class Column {
@@ -34,17 +33,25 @@ public final class Column {
private final String tableName;
+ private final int hashCode;
+
+ public Column(final String name, final String tableName) {
+ this.name = name;
+ this.tableName = tableName;
+ hashCode = Objects.hash(name.toUpperCase(), tableName.toUpperCase());
+ }
+
@Override
public boolean equals(final Object obj) {
if (obj instanceof Column) {
Column column = (Column) obj;
- return Objects.equal(name.toUpperCase(), column.name.toUpperCase()) && Objects.equal(tableName.toUpperCase(), column.tableName.toUpperCase());
+ return (name == column.name || null != name && name.equalsIgnoreCase(column.name)) && (tableName == column.tableName || null != tableName && tableName.equalsIgnoreCase(column.tableName));
}
return false;
}
@Override
public int hashCode() {
- return Objects.hashCode(name.toUpperCase(), tableName.toUpperCase());
+ return hashCode;
}
}