🐳 javadoc

This commit is contained in:
渔民小镇 2024-08-05 14:32:47 +08:00
parent a3d5d0b9cb
commit 10e860891d
15 changed files with 347 additions and 22 deletions

View File

@ -0,0 +1,25 @@
/*
* ioGame
* Copyright (C) 2021 - present 渔民小镇 262610965@qq.comluoyizhu@gmail.com . All Rights Reserved.
* # iohao.com . 渔民小镇
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* 业务框架 - 注解相关
*
* @author 渔民小镇
* @date 2024-08-05
*/
package com.iohao.game.action.skeleton.annotation;

View File

@ -0,0 +1,25 @@
/*
* ioGame
* Copyright (C) 2021 - present 渔民小镇 262610965@qq.comluoyizhu@gmail.com . All Rights Reserved.
* # iohao.com . 渔民小镇
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* 业务框架 - action 构建时的监听器
*
* @author 渔民小镇
* @date 2024-08-05
*/
package com.iohao.game.action.skeleton.core.action.parser;

View File

@ -0,0 +1,57 @@
/*
* ioGame
* Copyright (C) 2021 - present 渔民小镇 262610965@qq.comluoyizhu@gmail.com . All Rights Reserved.
* # iohao.com . 渔民小镇
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* 业务框架 - 业务数据的编解码器<a href="https://www.yuque.com/iohao/game/uq2zrltrc7to27bt">扩展协议</a>
* <br/>
* 简介
* <pre>
* ioGame 支持同样的一套业务代码且无需做变更任何业务代码就能支持序列化库的切换 protobufjson或其他的扩展序列化库
* ioGame 中切换协议是简单的只需要一行代码这种扩展方式基本做到了零迁移成本零维护成本零学习成本
* </pre>
* ioGame 中的业务数据协议是通过 java 类来定义的这么做的优点有
* <pre>
* 1. 即使是 java 新手也能看得明白而通过 DSL 生成的 java 代码是不可能这么清晰的
* 2. 同时`Student` 类既能支持 protobuf 又能支持 json 且开发者无需做任何变更这点是 DSL 做不到的
* 3. 还能支持 [JSR380 验证 (yuque.com)](https://www.yuque.com/iohao/game/ghng6g)在属性上添加 JSR380 相关注解即可这点是 DSL 做不到的
* 4. 此外还能在协议类中添加一些自定义方法这点是 DSL 做不到的
* 5. 减少学习成本不需要学习各种 DSL 相关库的语法
*
* 结论支持 java 代码定义协议的序列化库会优先做支持比如将来支持了 Fury那么开发者无需变更现有的业务代码就能直接使用从而为开发者减少迁移成本维护成本学习成本
*
* 相关讨论 https://github.com/iohao/ioGame/issues/317
* </pre>
*
* 不对现有的业务代码做变更只需设置当前所使用的编解码器就能切换序列化库
* <pre>{@code
* public void chooseCodec() {
* // 使用 JSON 编解码
* IoGameGlobalSetting.setDataCodec(new JsonDataCodec());
* // 使用 Protobuf 编解码
* IoGameGlobalSetting.setDataCodec(new ProtoDataCodec());
* // 使用 Fury 编解码
* IoGameGlobalSetting.setDataCodec(new FuryDataCodec());
* }
* }</pre>
* 之后如果支持了 Fury我们只需要扩展一个 FuryDataCodec 编解码器即可
* 这种扩展方式基本做到了零迁移成本零维护成本零学习成本
*
* @author 渔民小镇
* @date 2024-08-05
*/
package com.iohao.game.action.skeleton.core.codec;

View File

@ -0,0 +1,25 @@
/*
* ioGame
* Copyright (C) 2021 - present 渔民小镇 262610965@qq.comluoyizhu@gmail.com . All Rights Reserved.
* # iohao.com . 渔民小镇
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* 业务框架 - 通讯相关接口
*
* @author 渔民小镇
* @date 2024-08-05
*/
package com.iohao.game.action.skeleton.core.commumication;

View File

@ -0,0 +1,25 @@
/*
* ioGame
* Copyright (C) 2021 - present 渔民小镇 262610965@qq.comluoyizhu@gmail.com . All Rights Reserved.
* # iohao.com . 渔民小镇
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* 业务框架 - <a href="https://www.yuque.com/iohao/game/irth38">文档生成相关</a>
*
* @author 渔民小镇
* @date 2024-08-05
*/
package com.iohao.game.action.skeleton.core.doc;

View File

@ -17,12 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* 系统异常全局统一处理
*
* <pre>
* 关于异常机制的解释可以参考这里:
* <a href="https://www.yuque.com/iohao/game/avlo99">断言 + 异常机制 = 清晰简洁的代码</a>
* </pre>
* 业务框架 - 系统异常全局统一处理<a href="https://www.yuque.com/iohao/game/avlo99">断言 + 异常机制 = 清晰简洁的代码</a>
*
* @author 渔民小镇
* @date 2022-01-14

View File

@ -0,0 +1,25 @@
/*
* ioGame
* Copyright (C) 2021 - present 渔民小镇 262610965@qq.comluoyizhu@gmail.com . All Rights Reserved.
* # iohao.com . 渔民小镇
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* 业务框架 - <a href="https://www.yuque.com/iohao/game/vfnqpum6hrt23mnf">动态属性</a>
*
* @author 渔民小镇
* @date 2024-08-05
*/
package com.iohao.game.action.skeleton.core.flow.attr;

View File

@ -0,0 +1,25 @@
/*
* ioGame
* Copyright (C) 2021 - present 渔民小镇 262610965@qq.comluoyizhu@gmail.com . All Rights Reserved.
* # iohao.com . 渔民小镇
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* 业务框架 - <a href="https://www.yuque.com/iohao/game/bsgvzglvlr5tenao">插件介绍</a>
*
* @author 渔民小镇
* @date 2024-08-05
*/
package com.iohao.game.action.skeleton.core.flow.internal;

View File

@ -0,0 +1,25 @@
/*
* ioGame
* Copyright (C) 2021 - present 渔民小镇 262610965@qq.comluoyizhu@gmail.com . All Rights Reserved.
* # iohao.com . 渔民小镇
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* 业务框架 - <a href="https://www.yuque.com/iohao/game/wiwpwusmktrv35i4">核心流程处理</a>
*
* @author 渔民小镇
* @date 2024-08-05
*/
package com.iohao.game.action.skeleton.core.flow;

View File

@ -0,0 +1,25 @@
/*
* ioGame
* Copyright (C) 2021 - present 渔民小镇 262610965@qq.comluoyizhu@gmail.com . All Rights Reserved.
* # iohao.com . 渔民小镇
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* 业务框架 - action 参数解析器解析方法参数解析方法返回值
*
* @author 渔民小镇
* @date 2024-08-05
*/
package com.iohao.game.action.skeleton.core.flow.parser;

View File

@ -0,0 +1,25 @@
/*
* ioGame
* Copyright (C) 2021 - present 渔民小镇 262610965@qq.comluoyizhu@gmail.com . All Rights Reserved.
* # iohao.com . 渔民小镇
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* 业务框架 - core
*
* @author 渔民小镇
* @date 2024-08-05
*/
package com.iohao.game.action.skeleton.core;

View File

@ -17,11 +17,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* {@link com.iohao.game.action.skeleton.core.runner.Runner} 机制类似于 Spring CommandLineRunner 的启动项它能够在逻辑服务器启动之后调用一次 Runner 接口实现类让开发者能够通过实现 Runner 接口来扩展自身的系统
* 业务框架 - <a href="https://www.yuque.com/iohao/game/dpwe6r6sqwwtrh1q">Runner 扩展机制</a>机制类似于 Spring CommandLineRunner 的启动项它能够在逻辑服务器启动之后调用一次 Runner 接口实现类让开发者能够通过实现 Runner 接口来扩展自身的系统
* <p>
* Runner 机制会在逻辑服与 Broker游戏网关建立连接之前之后分别触发一次对应的方法<a href="https://www.yuque.com/iohao/game/dpwe6r6sqwwtrh1q">相关文档</a>
* Runner 机制会在逻辑服与 Broker游戏网关建立连接之前之后分别触发一次对应的方法
*
* @author 渔民小镇
* @date 2024-06-05
* @see com.iohao.game.action.skeleton.core.runner.Runner
*/
package com.iohao.game.action.skeleton.core.runner;

View File

@ -17,13 +17,55 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* 业务框架
* 业务框架 - <a href="https://www.yuque.com/iohao/game/wiwpwusmktrv35i4">业务框架简介</a>
* <pre>
* 如果对业务框架源码业务框架处理流感兴趣的可以阅读一下这篇文档
*
* 文档地址
* https://www.yuque.com/iohao/game/gz4i3k
* 如果说 sofa-bolt 是为了让 Java 程序员能将更多的精力放在基于网络通信的业务逻辑实现上而业务框架正是解决业务逻辑如何方便实现这一问题上
* 业务框架是游戏框架的一部分职责是简化程序员的业务逻辑实现业务框架使程序员能够快速的开始编写游戏业务
* </pre>
* <p>
* for example
* <pre>{@code
* @ActionController(1)
* public class DemoAction {
* @ActionMethod(0)
* public HelloReq here(HelloReq helloReq) {
* // 业务数据
* var newHelloReq = new HelloReq();
* newHelloReq.name = helloReq.name + ", I'm here ";
* return newHelloReq;
* }
*
* // 注意这个方法只是为了演示而写的ioGame21 开始支持
* // 效果与上面的方法一样只不过是用广播推送的方式将数据返回给请求方
* @ActionMethod(0)
* public void here(HelloReq helloReq, FlowContext flowContext) {
* // 业务数据
* var newHelloReq = new HelloReq();
* newHelloReq.name = helloReq.name + ", I'm here ";
*
* flowContext.broadcastMe(newHelloReq);
* }
*
* // 跨服调用示例下面分别展示了同步与异步回调的写法
* void testShowInvokeModule(FlowContext flowContext) {
* var cmdInfo = CmdInfo.of(1,0);
* var yourData = ... 你的请求参数
*
* // 跨服请求异步回调 - 无阻塞-- 路由请求参数回调
* flowContext.invokeModuleMessageAsync(cmdInfo, yourData, responseMessage -> {
* var helloReq = responseMessage.getData(HelloReq.class);
* // --- 此异步回调具备全链路调用日志跟踪 ---
* log.info("异步回调 : {}", helloReq);
* });
*
*
* // 跨服请求同步 - 阻塞-- 路由请求参数
* ResponseMessage responseMessage = flowContext.invokeModuleMessage(cmdInfo, yourData);
* var helloReq = responseMessage.getData(HelloReq.class);
* log.info("同步调用 : {}", helloReq);
* }
* }
* }</pre>
*
* @author 渔民小镇
* @date 2022-09-23

View File

@ -28,7 +28,7 @@ import java.util.List;
/**
* ioGame 启动新闻
* <pre>
* 名字来源 Michael Jackson 的歌曲 BreakingNews
* 名字来源 Michael Jackson 的歌曲 Breaking News
* </pre>
*
* @author 渔民小镇
@ -37,11 +37,11 @@ import java.util.List;
@UtilityClass
class BreakingNews {
List<News> randomNewsList(int num) {
List<News> randomNewsList() {
List<News> news = listNews();
Collections.shuffle(news);
return news.stream().limit(num).toList();
return news.stream().limit(2).toList();
}
News randomAdv() {
@ -51,8 +51,14 @@ class BreakingNews {
return RandomKit.randomEle(list);
}
News ioGameJavadocApi() {
return new News("ioGame javadoc", "https://www.yuque.com/iohao/game/nlbkmzn76mxnmhv6");
News randomMainNews() {
var list = List.of(
new BreakingNews.News("ioGame javadoc", "https://www.yuque.com/iohao/game/nlbkmzn76mxnmhv6"),
new BreakingNews.News("ioGame issues", "https://github.com/iohao/ioGame/issues"),
new BreakingNews.News("ioGame 框架各版本更新日志", "https://www.yuque.com/iohao/game/ab15oe")
);
return RandomKit.randomEle(list);
}
private List<News> listNews() {
@ -75,7 +81,6 @@ class BreakingNews {
list.add(new News("ioGameAdmin 运维监控", "https://www.yuque.com/iohao/game/xwxxcynh9yz0z8w4"));
list.add(new News("ioGame 诞生、发展", "https://www.yuque.com/iohao/game/mun9gbwzfph3y5vn"));
list.add(new News("框架版本更新日志", "https://www.yuque.com/iohao/game/ab15oe"));
list.add(new News("需要给到游戏前端的", "https://www.yuque.com/iohao/game/zfg3ci"));
// 整体架构相关

View File

@ -140,7 +140,7 @@ public final class IoGameBanner {
private void extractedBreakingNews() {
// 每次展示 N 条小报
var newsList = BreakingNews.randomNewsList(2);
var newsList = BreakingNews.randomNewsList();
for (BreakingNews.News news : newsList) {
System.out.printf("| News | %s%n", news);
}
@ -156,8 +156,8 @@ public final class IoGameBanner {
}
private void extractedIoGameJavadocApi() {
String s = BreakingNews.ioGameJavadocApi().toString();
String builder = "| javadoc | %s%n";
String s = BreakingNews.randomMainNews().toString();
String builder = "| | %s%n";
System.out.printf(builder, s);
System.out.println("+----------+--------------------------------------------------------------------------------------");
}