|
|
@ -18,12 +18,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
package com.tencent.cloud.rpc.enhancement.feign;
|
|
|
|
package com.tencent.cloud.rpc.enhancement.feign;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Comparator;
|
|
|
|
import java.util.Comparator;
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.google.common.collect.ArrayListMultimap;
|
|
|
|
|
|
|
|
import com.google.common.collect.Multimap;
|
|
|
|
import com.tencent.cloud.rpc.enhancement.feign.plugin.EnhancedFeignContext;
|
|
|
|
import com.tencent.cloud.rpc.enhancement.feign.plugin.EnhancedFeignContext;
|
|
|
|
import com.tencent.cloud.rpc.enhancement.feign.plugin.EnhancedFeignPlugin;
|
|
|
|
import com.tencent.cloud.rpc.enhancement.feign.plugin.EnhancedFeignPlugin;
|
|
|
|
import com.tencent.cloud.rpc.enhancement.feign.plugin.EnhancedFeignPluginType;
|
|
|
|
import com.tencent.cloud.rpc.enhancement.feign.plugin.EnhancedFeignPluginType;
|
|
|
@ -37,18 +36,13 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public class DefaultEnhancedFeignPluginRunner implements EnhancedFeignPluginRunner {
|
|
|
|
public class DefaultEnhancedFeignPluginRunner implements EnhancedFeignPluginRunner {
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, List<EnhancedFeignPlugin>> pluginMap = new HashMap<>();
|
|
|
|
private final Multimap<String, EnhancedFeignPlugin> pluginMap = ArrayListMultimap.create();
|
|
|
|
|
|
|
|
|
|
|
|
public DefaultEnhancedFeignPluginRunner(List<EnhancedFeignPlugin> enhancedFeignPlugins) {
|
|
|
|
public DefaultEnhancedFeignPluginRunner(List<EnhancedFeignPlugin> enhancedFeignPlugins) {
|
|
|
|
if (!CollectionUtils.isEmpty(enhancedFeignPlugins)) {
|
|
|
|
if (!CollectionUtils.isEmpty(enhancedFeignPlugins)) {
|
|
|
|
enhancedFeignPlugins.stream()
|
|
|
|
enhancedFeignPlugins.stream()
|
|
|
|
.sorted(Comparator.comparing(EnhancedFeignPlugin::getOrder))
|
|
|
|
.sorted(Comparator.comparing(EnhancedFeignPlugin::getOrder))
|
|
|
|
.forEach(plugin -> {
|
|
|
|
.forEach(plugin -> pluginMap.put(plugin.getType().name(), plugin));
|
|
|
|
if (!pluginMap.containsKey(plugin.getType().name())) {
|
|
|
|
|
|
|
|
pluginMap.put(plugin.getType().name(), new ArrayList<>());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pluginMap.get(plugin.getType().name()).add(plugin);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|