I'm completely new to Java and the Eclipse IDE. I have background with .NET and Visual Studio. In VS when I want to create a description for a method, I just type three "/" characters and I get an auto-generated comment template, which looks similarly to the example below:
/// <summary>
/// This is my summary. Hope it is helpful. ;)
/// </summary>
/// <param name="item">Description of the item parameter.</param>
/// <returns></returns>
T Add(T item);
So, when somebody uses my method, the IDE will give him/her a hint, which is visualized right on top of the method's name. How can I achieve this in Eclipse, giving descriptions for my Java methods?
You should use /** */ notation:
/** Comment */
private void method() {
}
It's called javadoc: http://en.wikipedia.org/wiki/Javadoc
/**
* regular
* @author John Doe
* @param
* @return
* @since 01-01-2000
* @version 1.0
* @exception PersonNotFoundException gevonden
*/
Java: Just put /**
before your method annotation and will generate auto. ;)
/**
* This is my summary. Hope it is helpful. ;)
*/
T Add(T item);
You can select a method, class, variable name and enter ALT+SHIFT+J in eclipse IDE to genereate auto java descriptions as below:-
/* (non-Javadoc)
* @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.