[英]Java: Method returns its own JavaDoc
I would like to write a Java method that returns its own JavaDoc as a String. 我想编写一个Java方法,将其自己的JavaDoc作为String返回。 Is this possible? 这可能吗?
eg: 例如:
class MyClass{
/** This method explains itself in a great length and describes
the parameters for the class. It is called whenever the parametrization
of that class (based on a config file) is incorrect to remind the user of
this class to fix it. */
public String explain() {
return "Here simply return the JavaDoc";
}
public boolean checkParams(){
// check parameters
// call explain if the check went wrong and return false
// return true if everything went fine.
}
}
You can't do that since it is removed from the compiled code. 您不能这样做,因为它已从编译代码中删除。 You might use annotations instead and write an annotation processor to read them. 您可以改用注释,并编写注释处理器以读取它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.