提交 e8c414f4 编写于 作者: T tristaZero

add getKeyGeneratorClassName()

上级 3ddc0ad8
......@@ -18,6 +18,7 @@
package io.shardingsphere.core.yaml.sharding;
import com.google.common.base.Strings;
import io.shardingsphere.core.exception.ShardingConfigurationException;
import io.shardingsphere.core.keygen.BuiltinKeyGeneratorType;
import io.shardingsphere.core.keygen.KeyGenerator;
import io.shardingsphere.core.keygen.KeyGeneratorFactory;
......@@ -62,4 +63,17 @@ public class YamlKeyGeneratorConfiguration {
result.setProperties(props);
return result;
}
private String getKeyGeneratorClassName() {
if (keyGeneratorType.equalsIgnoreCase(BuiltinKeyGeneratorType.SNOWFLAKE.name())) {
return BuiltinKeyGeneratorType.SNOWFLAKE.getKeyGeneratorClassName();
}
if (keyGeneratorType.equalsIgnoreCase(BuiltinKeyGeneratorType.UUID.name())) {
return BuiltinKeyGeneratorType.UUID.getKeyGeneratorClassName();
}
if (keyGeneratorType.equalsIgnoreCase(BuiltinKeyGeneratorType.LEAF.name())) {
return BuiltinKeyGeneratorType.LEAF.getKeyGeneratorClassName();
}
throw new ShardingConfigurationException("Invalid built-in key generator type.");
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册