[英]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.