Class AbstractClientCommandStrategy
java.lang.Object
io.github.lunasaw.gbproxy.client.transmit.cmd.strategy.AbstractClientCommandStrategy
- All Implemented Interfaces:
ClientCommandStrategy
- Direct Known Subclasses:
AckCommandStrategy,ByeCommandStrategy,InfoCommandStrategy,InviteCommandStrategy,MessageCommandStrategy,NotifyCommandStrategy,RegisterCommandStrategy,SubscribeCommandStrategy
抽象客户端命令策略基类
提供通用的命令执行逻辑和工具方法
- Author:
- luna
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbuildCommandContent(FromDevice fromDevice, ToDevice toDevice, Object... params) 构建命令内容execute(FromDevice fromDevice, ToDevice toDevice, Event errorEvent, Event okEvent, Object... params) 执行命令(带事件)execute(FromDevice fromDevice, ToDevice toDevice, Object... params) 执行命令protected String生成随机序列号protected StringgetDeviceId(FromDevice fromDevice) 获取设备IDprotected StringsendCommand(FromDevice fromDevice, ToDevice toDevice, String content, Event errorEvent, Event okEvent) 发送命令protected voidvalidateParams(FromDevice fromDevice, ToDevice toDevice, Object... params) 参数校验Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.lunasaw.gbproxy.client.transmit.cmd.strategy.ClientCommandStrategy
getCommandDescription, getCommandType
-
Constructor Details
-
AbstractClientCommandStrategy
public AbstractClientCommandStrategy()
-
-
Method Details
-
execute
Description copied from interface:ClientCommandStrategy执行命令- Specified by:
executein interfaceClientCommandStrategy- Parameters:
fromDevice- 发送设备toDevice- 接收设备params- 命令参数- Returns:
- callId
-
execute
public String execute(FromDevice fromDevice, ToDevice toDevice, Event errorEvent, Event okEvent, Object... params) Description copied from interface:ClientCommandStrategy执行命令(带事件)- Specified by:
executein interfaceClientCommandStrategy- Parameters:
fromDevice- 发送设备toDevice- 接收设备errorEvent- 错误事件okEvent- 成功事件params- 命令参数- Returns:
- callId
-
validateParams
参数校验- Parameters:
fromDevice- 发送设备toDevice- 接收设备params- 参数
-
buildCommandContent
构建命令内容- Parameters:
fromDevice- 发送设备toDevice- 接收设备params- 参数- Returns:
- 命令内容
-
sendCommand
protected String sendCommand(FromDevice fromDevice, ToDevice toDevice, String content, Event errorEvent, Event okEvent) 发送命令- Parameters:
fromDevice- 发送设备toDevice- 接收设备content- 命令内容errorEvent- 错误事件okEvent- 成功事件- Returns:
- callId
-
generateSn
生成随机序列号- Returns:
- 序列号
-
getDeviceId
获取设备ID- Parameters:
fromDevice- 发送设备- Returns:
- 设备ID
-