gpt4 book ai didi

java - 如何在注释中生成/声明注释字段?

转载 作者:行者123 更新时间:2023-12-01 09:09:38 24 4
gpt4 key购买 nike

我想要得到这样的东西:

public @interface Unfinished {
String value();
String value() default "someVal";
}

问题是我无法使用 JFieldVar,因为它看起来像这样:

String value; //no parentheses 
String value = "someVal"; //no parentheses, no "default", "=" sign

最佳答案

一种可能的方法是使用 jDefinedClass.direct:

annotationClass.direct("String value();")
annotationClass.direct("String value() default \"someVal\";")

但我不喜欢这种方法。我会使用类似于 JFielVar 的东西。

关于java - 如何在注释中生成/声明注释字段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41001222/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com