com.github.dennisit.vplus.data.dsource.shard.ShardLookup Maven / Gradle / Ivy
package com.github.dennisit.vplus.data.dsource.shard;
import com.github.dennisit.vplus.data.dsource.shard.strategy.ShardStrategy;
public class ShardLookup implements Lookup {
private boolean shard = false;
private String tableName;
private String dataSourceKey;
private Integer tableShardNum;
private Integer dbShardNum;
private String shardType;
private Object shardValue;
public ShardLookup(String dataSourceKey) {
this.dataSourceKey = dataSourceKey;
}
public ShardLookup(String tableName, String dataSourceKey, Integer tableShardNum, Integer dbShardNum, String shardType, Object shardValue) {
this.shard = true;
this.tableName = tableName;
this.dataSourceKey = dataSourceKey;
this.tableShardNum = tableShardNum;
this.dbShardNum = dbShardNum;
this.shardType = shardType;
this.shardValue = shardValue;
}
public void setDataTableName(ShardStrategy.DataTableName dataTableName) {
this.tableName = dataTableName.getTableName();
this.dataSourceKey = dataTableName.getDataSourceKey();
}
public boolean isShard() {
return this.shard;
}
public String getTableName() {
return this.tableName;
}
public String getDataSourceKey() {
return this.dataSourceKey;
}
public Integer getTableShardNum() {
return this.tableShardNum;
}
public Integer getDbShardNum() {
return this.dbShardNum;
}
public String getShardType() {
return this.shardType;
}
public Object getShardValue() {
return this.shardValue;
}
}