/*
 * Copyright © 2013-2020, The SeedStack authors <http://seedstack.org>
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package org.seedstack.netflix.hystrix.internal;

import static com.google.common.base.Preconditions.checkNotNull;

import com.google.common.base.Strings;
import java.lang.reflect.Method;
import java.util.Arrays;
import org.apache.commons.lang.StringUtils;
import org.seedstack.netflix.hystrix.HystrixCommand;
import org.seedstack.shed.reflect.Classes;

class CommandDefinition {
    private final Method commandMethod;
    private final Method fallbackMethod;
    private final String groupKey;
    private final String commandKey;

    CommandDefinition(Method commandMethod) {
        this.commandMethod = checkNotNull(commandMethod, "Missing command method");
        HystrixCommand hystrixCommand = HystrixCommandAnnotationResolver.INSTANCE
                .apply(commandMethod)
                .orElseThrow(() -> new IllegalArgumentException("Missing @HystrixCommand annotation on method "
                        + commandMethod));

        this.fallbackMethod = resolveFallbackMethod(hystrixCommand);
        this.groupKey = resolveGroupKey(hystrixCommand);
        this.commandKey = resolveCommandKey(hystrixCommand);
    }

    Method getCommandMethod() {
        return commandMethod;
    }

    Method getFallbackMethod() {
        return fallbackMethod;
    }

    String getGroupKey() {
        return groupKey;
    }

    String getCommandKey() {
        return commandKey;
    }

    private String resolveGroupKey(HystrixCommand hystrixCommand) {
        return Strings.isNullOrEmpty(hystrixCommand.groupKey())
                ? commandMethod.getDeclaringClass().getName() : hystrixCommand.groupKey();
    }

    private String resolveCommandKey(HystrixCommand hystrixCommand) {
        return Strings.isNullOrEmpty(hystrixCommand.commandKey())
                ? commandMethod.getName() : hystrixCommand.commandKey();
    }

    private Method resolveFallbackMethod(HystrixCommand hystrixCommand) {
        if (StringUtils.isNotBlank(hystrixCommand.fallbackMethod())) {
            Class<?>[] parameterTypes = commandMethod.getParameterTypes();
            return Classes.from(commandMethod.getDeclaringClass())
                    .traversingSuperclasses()
                    .traversingInterfaces()
                    .method(hystrixCommand.fallbackMethod(), parameterTypes)
                    .orElseThrow(() -> new RuntimeException("No fallback method found: "
                            + hystrixCommand.fallbackMethod() + "(" + Arrays.toString(parameterTypes) + ")"));
        }
        return null;
    }
}

@@ -345,15 +345,8 @@
 ort 
-static 
 com.
@@ -368,77 +368,116 @@
 ase.
-Preconditions.checkNotNull;%0D%0A%0D%0Aimport com.google.common.base.Strings;
+Strings;%0D%0Aimport org.seedstack.netflix.hystrix.HystrixCommand;%0D%0Aimport org.seedstack.shed.reflect.Classes;%0D%0A
 %0D%0Aim
@@ -538,148 +538,73 @@
 s;%0D%0A
+%0D%0A
 import 
-org.apache.commons.lang.StringUtils;%0D%0Aimport org.seedstack.netflix.hystrix.HystrixCommand;%0D%0Aimport org.seedstack.shed.reflect.Classes
+static com.google.common.base.Preconditions.checkNotNull
 ;%0D%0A%0D
@@ -2227,30 +2227,30 @@
 if (
+!
 String
-Util
 s.isN
-otBlank
+ullOrEmpty
 (hys

Replace commons lang StringUtils call by Guava call