/*
 * Copyright 2016-2018 shardingsphere.io.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * </p>
 */

package io.shardingsphere.core.keygen;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * Built-in key generator type.
 *
 * @author panjuan
 */
@RequiredArgsConstructor
@Getter
public enum KeyGeneratorType {
    
    SNOWFLAKE("io.shardingsphere.core.keygen.DefaultKeyGenerator"),
    UUID(""),
    LEAF("");
    
    private final String keyGeneratorClassName;
    
    /**
     * Get built-in key generator type.
     * 
     * @param keyGeneratorClassName key generator class name
     * @return built-in key generator type
     */
    public static KeyGeneratorType getKeyGeneratorType(final String keyGeneratorClassName) {
        for (KeyGeneratorType each : KeyGeneratorType.values()) {
            if (each.getKeyGeneratorClassName().equals(keyGeneratorClassName)) {
                return each;
            }
        }
        return null;
    }
}

@@ -653,16 +653,56 @@
 eygen;%0A%0A
+import com.google.common.base.Optional;%0A
 import l
@@ -1059,25 +1059,16 @@
   * Get 
-built-in 
 key gene
@@ -1167,17 +1167,8 @@
 urn 
-built-in 
 key 
@@ -1208,16 +1208,25 @@
  static 
+Optional%3C
 KeyGener
@@ -1233,16 +1233,17 @@
 atorType
+%3E
  getKeyG
@@ -1463,20 +1463,33 @@
  return 
+Optional.of(
 each
+)
 ;%0A      
@@ -1525,12 +1525,25 @@
 urn 
-null
+Optional.absent()
 ;%0A  

use Optional.absent()