Skip to content

Commit

Permalink
🐳 feat(GenerateDoc): 1. Add DocumentMethod annotation : Action suppor…
Browse files Browse the repository at this point in the history
…ts generating documentation method names through annotations.

2. BroadcastDebug enhancements.
  • Loading branch information
iohao committed Nov 12, 2024
1 parent e1f8422 commit 2087050
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@ public ActionMethodDocument(ActionCommandDoc actionCommandDoc, TypeMappingDocume
this.actionSimpleName = actionCommand.getActionControllerClazz().getSimpleName();

// 方法名
this.actionMethodName = StrKit.firstCharToUpperCase(actionCommand.getActionMethodName());
var documentMethod = actionCommand.getAnnotation(DocumentMethod.class);
if (Objects.nonNull(documentMethod)) {
this.actionMethodName = StrKit.firstCharToUpperCase(documentMethod.value());
} else {
this.actionMethodName = StrKit.firstCharToUpperCase(actionCommand.getActionMethodName());
}

// 方法注释
this.methodComment = this.actionCommandDoc.getComment();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* ioGame
* Copyright (C) 2021 - present 渔民小镇 ([email protected][email protected]) . 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/>.
*/
package com.iohao.game.action.skeleton.core.doc;

import java.lang.annotation.*;

/**
* Generates the document action method name. By default, the action method name is used.
*
* @author 渔民小镇
* @date 2024-11-12
* @since 21.20
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface DocumentMethod {
/**
* The method name of the document action
*
* @return method name
*/
String value();
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ private int lookBusinessCodeInTrace(StackTraceElement[] traces) {
if (RangeBroadcast.class.getName().equals(name)) {
return index + 1;
}

if ("com.iohao.game.action.skeleton.core.flow.SimpleCommunicationBroadcast".equals(name)) {
return index + 1;
}
}

return 2;
Expand Down

0 comments on commit 2087050

Please sign in to comment.