[英]Java: Method returns its own JavaDoc
我想编写一个Java方法,将其自己的JavaDoc作为String返回。 这可能吗?
例如:
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.
}
}
您不能这样做,因为它已从编译代码中删除。 您可以改用注释,并编写注释处理器以读取它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.