mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
commit
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user