public class BotManagerImpl extends Object implements BotManager
BotManager的基础实现类,使用Map储存数据。| Constructor and Description |
|---|
BotManagerImpl(PathAssembler pathAssembler,
VerifyFunction verifyFunction) |
| Modifier and Type | Method and Description |
|---|---|
BotInfo[] |
bots()
获取全部的bots信息
|
BotInfo |
defaultBot()
大多数情况下,可能不一定必须指定一个bot,则此方法规定获取一个默认的bot
|
BotInfo |
getBot(String botCode)
通过bot的code获取一个Bot的信息
|
PathAssembler |
getPathAssembler()
获取路径拼接函数
|
VerifyFunction |
getVerifyFunction()
获取注册用的验证函数
|
BotInfo |
logOutBot(String code)
注销掉一个bot,将其从bot列表中移除。
|
void |
refreshBot(String code)
刷新一个Bot的账号信息
|
BotInfo |
registerBot(BotInfo info)
注册一个botInfo。在实现的时候需要注意线程安全问题,概率较小,但是不是没有可能
|
void |
setDefaultBot(String botCode)
设置默认bot的账号信息
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitrefreshBot, registerBot, registerBot, registerBot, registerBotpublic BotManagerImpl(PathAssembler pathAssembler, VerifyFunction verifyFunction)
public BotInfo defaultBot()
defaultBot in interface BotManagerpublic void setDefaultBot(String botCode)
setDefaultBot in interface BotManagerbotCode - 默认bot的账号信息public BotInfo getBot(String botCode)
getBot in interface BotManagerbotCode - 账号public BotInfo[] bots()
bots in interface BotManagerpublic BotInfo registerBot(BotInfo info)
registerBot in interface BotManagerinfo - bot信息,作为key的code信息将会从其中获取。info中path必须存在。
会对账号进行一次验证,如果通过则会添加。public BotInfo logOutBot(String code)
logOutBot in interface BotManagercode - 要注销掉的bot账号public void refreshBot(String code)
refreshBot in interface BotManagercode - 要刷新的bot账号的信息public VerifyFunction getVerifyFunction()
getVerifyFunction in interface BotManagerpublic PathAssembler getPathAssembler()
getPathAssembler in interface BotManagerCopyright © 2020. All rights reserved.