@@ -0,0 +1,3128 @@
+/*%0A * Copyright 2016-2018 shardingsphere.io.%0A * %3Cp%3E%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A * %3C/p%3E%0A */%0A%0Apackage io.shardingsphere.core.yaml.sharding;%0A%0Aimport com.google.common.base.Preconditions;%0Aimport com.google.common.base.Strings;%0Aimport io.shardingsphere.api.config.rule.TableRuleConfiguration;%0Aimport io.shardingsphere.core.keygen.KeyGeneratorFactory;%0Aimport lombok.Getter;%0Aimport lombok.NoArgsConstructor;%0Aimport lombok.Setter;%0A%0A/**%0A * Yaml key generator configuration.%0A *%0A * @author panjuan%0A */%0A@NoArgsConstructor%0A@Getter%0A@Setter%0Apublic class YamlKeyGeneratorConfiguration %7B%0A    %0A    private String logicTable;%0A    %0A    private String actualDataNodes;%0A    %0A    private YamlShardingStrategyConfiguration databaseStrategy;%0A    %0A    private YamlShardingStrategyConfiguration tableStrategy;%0A    %0A    private String keyGeneratorColumnName;%0A    %0A    private String keyGeneratorClassName;%0A    %0A    private String logicIndex;%0A    %0A    public YamlKeyGeneratorConfiguration(final TableRuleConfiguration tableRuleConfiguration) %7B%0A        logicTable = tableRuleConfiguration.getLogicTable();%0A        actualDataNodes = tableRuleConfiguration.getActualDataNodes();%0A        databaseStrategy = new YamlShardingStrategyConfiguration(tableRuleConfiguration.getDatabaseShardingStrategyConfig());%0A        tableStrategy = new YamlShardingStrategyConfiguration(tableRuleConfiguration.getTableShardingStrategyConfig());%0A        keyGeneratorColumnName = tableRuleConfiguration.getKeyGeneratorColumnName();%0A        keyGeneratorClassName = null == tableRuleConfiguration.getKeyGenerator()%0A                ? null : tableRuleConfiguration.getKeyGenerator().getClass().getName();%0A    %7D%0A    %0A    /**%0A     * Build table rule configuration.%0A     *%0A     * @return table rule configuration%0A     */%0A    public TableRuleConfiguration build() %7B%0A        Preconditions.checkNotNull(logicTable, %22Logic table cannot be null.%22);%0A        TableRuleConfiguration result = new TableRuleConfiguration();%0A        result.setLogicTable(logicTable);%0A        result.setActualDataNodes(actualDataNodes);%0A        if (null != databaseStrategy) %7B%0A            result.setDatabaseShardingStrategyConfig(databaseStrategy.build());%0A        %7D%0A        if (null != tableStrategy) %7B%0A            result.setTableShardingStrategyConfig(tableStrategy.build());%0A        %7D%0A        if (!Strings.isNullOrEmpty(keyGeneratorClassName)) %7B%0A            result.setKeyGenerator(KeyGeneratorFactory.newInstance(keyGeneratorClassName));%0A        %7D%0A        result.setKeyGeneratorColumnName(keyGeneratorColumnName);%0A        result.setLogicIndex(logicIndex);%0A        return result;%0A    %7D%0A%7D%0A

add YamlKeyGeneratorConfiguration.java