mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 19:45:09 +08:00
update 电单车协议
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.electricbicycles.AbstractEBikeHandler;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 工厂设计模式
|
||||
* 云快充操作
|
||||
*/
|
||||
public class EBikeOperateFactory {
|
||||
|
||||
private static Map<String, AbstractEBikeHandler> strategyMap = Maps.newHashMap();
|
||||
|
||||
/**
|
||||
* 注册
|
||||
* @param str
|
||||
* @param handler
|
||||
*/
|
||||
public static void register(String str, AbstractEBikeHandler handler) {
|
||||
if (StringUtils.isBlank(str) || Objects.isNull(handler)) {
|
||||
return;
|
||||
}
|
||||
strategyMap.put(str, handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static AbstractEBikeHandler getInvokeStrategy(String name) {
|
||||
return strategyMap.get(name);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package com.jsowell.netty.factory;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.netty.handler.yunkuaichong.AbstractHandler;
|
||||
import com.jsowell.netty.handler.yunkuaichong.AbstractYkcHandler;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -13,14 +13,14 @@ import java.util.Objects;
|
||||
*/
|
||||
public class YKCOperateFactory {
|
||||
|
||||
private static Map<String, AbstractHandler> strategyMap = Maps.newHashMap();
|
||||
private static Map<String, AbstractYkcHandler> strategyMap = Maps.newHashMap();
|
||||
|
||||
/**
|
||||
* 注册
|
||||
* @param str
|
||||
* @param handler
|
||||
*/
|
||||
public static void register(String str, AbstractHandler handler) {
|
||||
public static void register(String str, AbstractYkcHandler handler) {
|
||||
if (StringUtils.isBlank(str) || Objects.isNull(handler)) {
|
||||
return;
|
||||
}
|
||||
@@ -32,7 +32,7 @@ public class YKCOperateFactory {
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static AbstractHandler getInvokeStrategy(String name) {
|
||||
public static AbstractYkcHandler getInvokeStrategy(String name) {
|
||||
return strategyMap.get(name);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user