@Override
public ShardId getShardIdForStatementOrParameter(String statement, Object parameter,
List<Shard> shardsToConsider) {
// TODO(fengkuok) optimize this by keeping an identity map of objects to shardId
Shard shard = getShardForStatement(statement, shardsToConsider);
if (shard == null) {
return null;
} else if (shard.getShardIds().size() == 1) {
return shard.getShardIds().iterator().next();
} else {
//TODO(fengkuok) 似乎从来不会走到这个逻辑
IdGenerator idGenerator = shardedSqlSessionFactory.getIdGenerator();
if (idGenerator != null) {
return idGenerator.extractShardId(this.extractId(parameter));