@@ -0,0 +1,2514 @@
+/*%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.api.config;%0A%0Aimport com.google.common.base.Strings;%0Aimport io.shardingsphere.core.exception.ShardingConfigurationException;%0Aimport io.shardingsphere.core.keygen.KeyGeneratorFactory;%0Aimport io.shardingsphere.core.keygen.KeyGeneratorType;%0Aimport io.shardingsphere.core.keygen.generator.KeyGenerator;%0Aimport lombok.Getter;%0Aimport lombok.Setter;%0A%0Aimport java.util.Properties;%0A%0A/**%0A * Key generator configuration.%0A *%0A * @author panjuan%0A */%0A@Getter%0A@Setter%0Apublic final class KeyGeneratorConfiguration %7B%0A    %0A    private String column;%0A    %0A    private String type;%0A    %0A    private String className;%0A    %0A    private Properties props = new Properties();%0A    %0A    /**%0A     * Build table rule configuration.%0A     *%0A     * @return table rule configuration%0A     */%0A    public KeyGenerator getKeyGenerator() %7B%0A        KeyGenerator result;%0A        if (!Strings.isNullOrEmpty(className)) %7B%0A            result = KeyGeneratorFactory.newInstance(className);%0A        %7D else if (!Strings.isNullOrEmpty(type)) %7B%0A            result = KeyGeneratorFactory.newInstance(getKeyGeneratorClassName());%0A        %7D else %7B%0A            result = KeyGeneratorFactory.newInstance(KeyGeneratorType.SNOWFLAKE.getKeyGeneratorClassName());%0A        %7D%0A        result.setProperties(props);%0A        return result;%0A    %7D%0A    %0A    private String getKeyGeneratorClassName() %7B%0A        if (type.equalsIgnoreCase(KeyGeneratorType.SNOWFLAKE.name())) %7B%0A            return KeyGeneratorType.SNOWFLAKE.getKeyGeneratorClassName();%0A        %7D%0A        if (type.equalsIgnoreCase(KeyGeneratorType.UUID.name())) %7B%0A            return KeyGeneratorType.UUID.getKeyGeneratorClassName();%0A        %7D%0A        if (type.equalsIgnoreCase(KeyGeneratorType.LEAF.name())) %7B%0A            return KeyGeneratorType.LEAF.getKeyGeneratorClassName();%0A        %7D%0A        throw new ShardingConfigurationException(%22Invalid key generator type.%22);%0A    %7D%0A%7D%0A

add KeyGeneratorConfiguration