2015-02-10 34 views
2

我有一個簡單的方法「的ValidateUser」返回取決於用戶是否是不同的字符串已成功登錄。我如何在Eclipse中使用JavaDocs來顯示條件返回語句?

Output specifications

現在我剛剛介紹的第一個可能的輸出。

/** 
* 
*@param user the username of the user 
*@param password the password of the user 
*@return True <br> 
*   User_First_Name<br> 
*   User_Last_Name<br> 
*   Num_Records 
* 
*/ 

什麼是使用javadocs顯示所有可能的輸出的最佳方式是什麼?

回答

4

一種選擇是保持@return簡單,並將詳細信息放在方法文檔中。

例如:

 
/** 
* Validates the user. 
* <p>If successful, returns a string including these lines:</p> 
* <blockquote> 
* TRUE 
* User_First_Name 
* User_Last_Name 
* Num_Records 
* </blockquote> 
* <p>Otherwise, returns "FALSE" or "FAILED".</p> 
* @param user the username of the user 
* @param password the password of the user 
* @return If successful, the multi-line string described above, 
* beginning with "TRUE". Returns "FALSE" if the user credentials 
* are invalid. Returns "FAILED" if the operation failed for any 
* reason (e.g., can't connect to the server, internal server error). 
*/