mirror of
https://github.com/LamGC/ContentGrabbingJi.git
synced 2025-04-29 14:17:33 +00:00
[Add] Framework-API 增加内置标准化 Platform Enum, 添加标准化平台信息文档;
[Add] Platform.Standard 添加私有内置的标准化 Platform 枚举类(已添加部分平台信息); [Add] Framework-API/StandardPlatform.md 添加标准化平台信息文档(用于参考或者直接使用, 帮助统一平台信息);
This commit is contained in:
parent
c39c239d2d
commit
22ec7c6741
11
ContentGrabbingJi-framework-api/StandardPlatform.md
Normal file
11
ContentGrabbingJi-framework-api/StandardPlatform.md
Normal file
@ -0,0 +1,11 @@
|
||||
# 由官方标准化的平台信息
|
||||
|
||||
在此定义了部分平台的平台名与标识信息,可作为参考。
|
||||
|
||||
Platform Name | Platform Identify
|
||||
--- | ---
|
||||
Tencent QQ | QQ
|
||||
Tencent WeChat | WeChat
|
||||
Discord | Discord
|
||||
Telegram | Telegram
|
||||
OneBot Http API | OneBot
|
@ -28,6 +28,9 @@ import java.util.Objects;
|
||||
* <p> {@link #platformIdentify PlatformIdentify}
|
||||
* 遵循 Camel-Case (骆峰命名法, 每个单词之间无空格, 单词首字母大写),
|
||||
* 对于平台标识由少量字母组成的则全大写(例如腾讯QQ的平台标识则为 'QQ' 而不是 'qq' 或 'Qq').
|
||||
*
|
||||
* <p> 希望各框架组件开发者能够遵循以上规则, 如出现平台识别信息混乱的情况, 不排除会有将 Platform 枚举化(固定 Platform 类型)的情况.
|
||||
*
|
||||
* @author LamGC
|
||||
*/
|
||||
public final class Platform {
|
||||
@ -86,4 +89,42 @@ public final class Platform {
|
||||
public int hashCode() {
|
||||
return Objects.hash(platformIdentify);
|
||||
}
|
||||
|
||||
/**
|
||||
* 标准化平台信息.
|
||||
* <p> 暂不公开, 仅用于 Platform 实例唯一化.
|
||||
*/
|
||||
private enum Standard {
|
||||
/**
|
||||
* 腾讯 QQ
|
||||
*/
|
||||
Tencent_QQ(new Platform("Tencent QQ", "QQ")),
|
||||
/**
|
||||
* 腾讯微信
|
||||
*/
|
||||
Tencent_WeChat(new Platform("Tencent WeChat", "WeChat")),
|
||||
/**
|
||||
* Telegram(电报)
|
||||
*/
|
||||
Telegram(new Platform("Telegram", "Telegram")),
|
||||
/**.
|
||||
* Discord
|
||||
*/
|
||||
Discord(new Platform("Discord", "Discord")),
|
||||
/**
|
||||
* OneBot
|
||||
*/
|
||||
OneBot(new Platform("OneBot Http API", "OneBot"))
|
||||
;
|
||||
private final Platform platform;
|
||||
|
||||
Standard(Platform platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
public Platform getPlatform() {
|
||||
return platform;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user