Javadoc
可以用 Javadoc 记录字段、方法和类型:
MethodSpec dismiss = MethodSpec.methodBuilder("dismiss")
.addJavadoc("Hides {@code message} from the caller's history. Other\n"
+ "participants in the conversation will continue to see the\n"
+ "message in their own history unless they also delete it.\n")
.addJavadoc("\n")
.addJavadoc("<p>Use {@link #delete($T)} to delete the entire\n"
+ "conversation for all participants.\n", Conversation.class)
.addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
.addParameter(Message.class, "message")
.build();
复制代码
将生成:
/**
* Hides {@code message} from the caller's history. Other
* participants in the conversation will continue to see the
* message in their own history unless they also delete it.
*
* <p>Use {@link #delete(Conversation)} to delete the entire
* conversation for all participants.
*/
void dismiss(Message message);
复制代码
在引用 Javadoc 中的类型时使用 $T
来获得自动导入。
根据这个说明 修改一下 可以被项目使用
增加标准的代码注释
MethodSpec dismiss = MethodSpec.methodBuilder("dismiss") .addJavadoc("方法说明\n") .addJavadoc("\n") .addJavadoc("@param $L $L\n", ParserTable.TestAcceptor2.class.getSimpleName(), "dto") .addJavadoc("@return $L $L\n", SwingUtilities2.AATextInfo.class.getSimpleName(), "result") .addJavadoc("@throws $L $L\n", Exception.class.getSimpleName(), "exception") .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT) .addParameter(Message.class, "message") .build();
转载:
作者:滑稽是我弟弟
链接:https://juejin.cn/post/6844904022600597517
来源:稀土掘金
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。