Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to insert XML comments in Java code in IntelliJ IDEA?

Maybe I'm missing something obvious, but I can't find a way to enable insertion of XML comments in Java code using the IntelliJ IDEA editor (v. 12 community edition).

I'm talking about comments like this:

/// <summary>
/// Encrypts plaintext using AES 128bit key and a Chain Block Cipher and returns a base64 encoded string
/// </summary>
/// <param name="plainText">Plain text to encrypt</param>
/// <param name="key">Secret key</param>
/// <returns>Base64 encoded string</returns>
public String encrypt(String plainText, String key) throws ...
like image 730
RenniePet Avatar asked Sep 05 '13 21:09

RenniePet


1 Answers

Place keyboard caret above your method. Type /** then hit ENTER. Intellj will create a template JavaDoc comment to which you can add a description of parameters and return value , for example:

/**
 *  Encrypts plaintext using AES 128bit key and a Chain Block Cipher and returns a base64 encoded string  
 * 
 * @param plainText  Plain text to encrypt
 * @param key  Secret key
 * @return Base64 encoded string
 */
public String encrypt(String plainText, String key) throws ...

To see a pop-up window with the formatted comment text place the caret inside /** ... */ and type Ctrl+Q

like image 94
Sergej Panic Avatar answered Nov 15 '22 03:11

Sergej Panic