class ShardingRuleBuilder {

    public ShardingRule build() {
//        构建数据库分片规则
        DataSourceRule dataSourceRule = buildDataSourceRule();
//        构建表规则配置
        Collection<TableRule> tableRules = buildTableRules(dataSourceRule);
//        创建分片配置对象构造器
        com.dangdang.ddframe.rdb.sharding.api.rule.ShardingRule.ShardingRuleBuilder shardingRuleBuilder = ShardingRule.builder().dataSourceRule(dataSourceRule);
        if (!Strings.isNullOrEmpty(shardingRuleConfig.getKeyGeneratorClass())) {//指定了自动创建分布式id的实现类
//            创建分布式id
            shardingRuleBuilder.keyGenerator(loadClass(shardingRuleConfig.getKeyGeneratorClass(), KeyGenerator.class));
        }
//        装载分片规则配置构造器的一些参数
        return shardingRuleBuilder.tableRules(tableRules).bindingTableRules(buildBindingTableRules(tableRules))
                .databaseShardingStrategy(buildShardingStrategy(shardingRuleConfig.getDefaultDatabaseStrategy(), DatabaseShardingStrategy.class))
                .tableShardingStrategy(buildShardingStrategy(shardingRuleConfig.getDefaultTableStrategy(), TableShardingStrategy.class)).build();
    }

    public  ShardingRuleBuilder(final ShardingRuleConfig shardingRuleConfig);
    public  ShardingRuleBuilder(final String logRoot, final ShardingRuleConfig shardingRuleConfig);
    public  ShardingRuleBuilder(final String logRoot, final Map<String, DataSource> externalDataSourceMap, final ShardingRuleConfig shardingRuleConfig);

}