/*
 * 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.jdbc.orchestration.config;

/**
 * Orchestration type.
 *
 * @author zhangliang
 */
public enum OrchestrationType {
    
    SHARDING, MASTER_SLAVE
}

@@ -667,16 +667,207 @@
 onfig;%0A%0A
+import com.google.common.base.Optional;%0Aimport com.google.common.base.Predicate;%0Aimport com.google.common.collect.Iterators;%0Aimport lombok.RequiredArgsConstructor;%0A%0Aimport java.util.Arrays;%0A%0A
 /**%0A * O
@@ -912,17 +912,61 @@
 liang%0A *
-/
+ @author panjuan%0A */%0A@RequiredArgsConstructor
 %0Apublic 
@@ -1007,16 +1007,28 @@
 SHARDING
+(%22SHARDING%22)
 , MASTER
@@ -1033,11 +1033,868 @@
 ER_SLAVE
+(%22MASTER_SLAVE%22);%0A    %0A    private final String typeName;%0A    %0A    /**%0A     * Get orchestration type enum via type name string.%0A     *%0A     * @param typeName type name string%0A     * @return orchestration enum%0A     */%0A    public static OrchestrationType valueFrom(final String typeName) %7B%0A        Optional%3COrchestrationType%3E typeOptional = Iterators.tryFind(Arrays.asList(OrchestrationType.values()).iterator(), new Predicate%3COrchestrationType%3E() %7B%0A            %0A            @Override%0A            public boolean apply(final OrchestrationType input) %7B%0A                return input.typeName.equals(typeName.toUpperCase());%0A            %7D%0A        %7D);%0A        if (typeOptional.isPresent()) %7B%0A            return typeOptional.get();%0A        %7D%0A        throw new UnsupportedOperationException(String.format(%22Can not support orchestration type %5B%25s%5D.%22, typeName));%0A    %7D
 %0A%7D%0A

add valueFrom()