I can't find any shortcut to generate javadoc comments. But if you type /**
before the method declaration and press Enter, the javadoc comment block will be generated automatically.
Read this for more information.
To generatae comments type /**
key before the method declaration and press Enter
. It will generage javadoc comment.
Example:
/**
* @param a
* @param b
*/
public void add(int a, int b) {
//code here
}
For more information check the link https://www.jetbrains.com/idea/features/javadoc.html
Here is an example of a JavaDoc comment from Oracle:
/**
* Returns an Image object that can then be painted on the screen.
* The url argument must specify an absolute {@link URL}. The name
* argument is a specifier that is relative to the url argument.
* <p>
* This method always returns immediately, whether or not the
* image exists. When this applet attempts to draw the image on
* the screen, the data will be loaded. The graphics primitives
* that draw the image will incrementally paint on the screen.
*
* @param url an absolute URL giving the base location of the image
* @param name the location of the image, relative to the url argument
* @return the image at the specified URL
* @see Image
*/
public Image getImage(URL url, String name) {
try {
return getImage(new URL(url, name));
} catch (MalformedURLException e) {
return null;
}
}
The basic format can be auto generated in either of the following ways:
/**
+ Enter
You can install JavaDoc plugin from Settings->Plugin->Browse repositories.
get plugin documentation from the below link
JavaDoc plugin document
Javadoc comments can be automatically appended by using your IDE's autocomplete feature. Try typing /**
and hitting Enter to generate a sample Javadoc comment.
/**
*
* @param action The action to execute.
* @param args The exec() arguments.
* @param callbackContext The callback context used when calling back into JavaScript.
* @return
* @throws JSONException
*/
You can use eclipse style of JavaDoc comment generation through "Fix doc comment". Open "Preference" -> "Keymap" and assign "Fix doc comment" action to a key that you want.
Here we can some something like this. And instead of using any shortcut we can write "default" comments at class/ package /project level. And modify as per requirement
*** Install JavaDoc Plugin ***
1.Press shift twice and Go to Plugins.
2. search for JavaDocs plugin
3. Install it.
4. Restart Android Studio.
5. Now, rightclick on Java file/package and goto
JavaDocs >> create javadocs for all elements
It will generate all default comments.
Advantage is that, you can create comment block for all the methods at a time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With