This commit is contained in:
2023-03-04 16:29:55 +08:00
commit 397ba75479
1007 changed files with 109050 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
package com.jsowell.netty.factory;
import com.google.common.collect.Maps;
import com.jsowell.common.util.StringUtils;
import com.jsowell.netty.handler.AbstractHandler;
import java.util.Map;
import java.util.Objects;
/**
* 工厂设计模式
* 云快充操作
*/
public class YKCOperateFactory {
private static Map<String, AbstractHandler> strategyMap = Maps.newHashMap();
/**
* 注册
* @param str
* @param handler
*/
public static void register(String str, AbstractHandler handler) {
if (StringUtils.isBlank(str) || Objects.isNull(handler)) {
return;
}
strategyMap.put(str, handler);
}
/**
* 获取
* @param name
* @return
*/
public static AbstractHandler getInvokeStrategy(String name) {
return strategyMap.get(name);
}
}