如何自定义 JAutodoc 模板

发布于 2024-09-28 02:49:20 字数 364 浏览 0 评论 0原文

我刚刚开始使用 JAutodoc 这真的相当不错。我现在正在自定义输出,并想知道是否可以根据类型名称自定义类型注释。本质上,我希望为 JUnit 测试类(其类名全部以“Test...”开头)提供一个注释,并为非单元测试类提供另一种类型注释。是否可以有一个基于类名子字符串匹配的条件?基本伪代码是(注意,这不起作用):

/**
#if (${e.g(1)} startsWith 'Test')
* I'm a JUnit test
#else
* I'm not a JUnit test class 
#end
*/

I've just starting using JAutodoc which is really rather nice. I'm now customizing the output and was wondering if its possible to customize the type comment based on the name of the type. Essentially, I'm looking to have one comment for JUnit test classess (whose class names all begin "Test...") and another type comment for non unit test classes. Is it possible to have a condition based on substring matching on the class name? Basic psuedo-code would be (note, this doesn't work):

/**
#if (${e.g(1)} startsWith 'Test')
* I'm a JUnit test
#else
* I'm not a JUnit test class 
#end
*/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不必在意 2024-10-05 02:49:20

创建一个新的类型模板。

名称:JUnit 测试
模式:测试(.+)
示例:TestMyClass

/**
 * I'm a JUnit test for ${e.g(1)}.
 */

Create a new Type Template.

Name: JUnit Test
Pattern: Test(.+)
Example: TestMyClass

/**
 * I'm a JUnit test for ${e.g(1)}.
 */
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文