Intellij IDEA 如何自动生成非javadoc 注释块?
Intellij IDEA how to auto-generate non-javadoc comment block?
在 Eclipse 中,当将 javadoc 注释块添加到接口在同一项目中的实现 class(某些接口的)方法时,我可以键入 /*(斜杠后跟星号)然后按 enter 键,它会立即在该方法的顶部生成一个非 javadoc 注释,该方法引用 class 使用 @see 注释实现的接口的 javadoc。我怎样才能在 Intellij IDEA 中实现这种行为?
您必须输入 /**
并按 ENTER 键
对于完整的实现:
在界面中您的方法上方添加以下代码。 @link
相当于 @see
.
/**
* {@inheritDoc}
* This printHello method is .......... you write explanation here
* {@link com.example.uddhav.memoryuse.MyInterface}
* I provided absolute reference of MyInterface here
*/
public void printHello(String str); /* your method */
在实现接口的 class 上,您 右键单击 > 生成 > 覆盖方法 > 检查 "copy javadoc"。
示例:
界面
public interface MyInterface {
/**
* {@inheritDoc}
* {@link com.example.uddhav.memoryuse.MyInterface}
* This printHello method is ..........
*/
public void printHello(String str);
/**
* {@inheritDoc}
* This printUddhav method is ..........
*/
public void printUddhav(String strr);
public void printGautam(String strr);
}
Class:
public class MainActivity extends AppCompatActivity implements MyInterface{
/* right click > generate > override methods > copy JavaDoc */
/* you are done */
/* I generated these below */
/**
* {@inheritDoc}
* {@link MyInterface}
* This printHello method is ..........
*
* @param str
*/
@Override
public void printHello(String str) {
}
/**
* {@inheritDoc}
* This printUddhav method is ..........
*
* @param strr
*/
@Override
public void printUddhav(String strr) {
}
@Override
public void printGautam(String strr) {
}
点击myInterface,您将被重定向到您在界面上的方法。
在 Eclipse 中,当将 javadoc 注释块添加到接口在同一项目中的实现 class(某些接口的)方法时,我可以键入 /*(斜杠后跟星号)然后按 enter 键,它会立即在该方法的顶部生成一个非 javadoc 注释,该方法引用 class 使用 @see 注释实现的接口的 javadoc。我怎样才能在 Intellij IDEA 中实现这种行为?
您必须输入 /**
并按 ENTER 键
对于完整的实现:
在界面中您的方法上方添加以下代码。 @link
相当于 @see
.
/**
* {@inheritDoc}
* This printHello method is .......... you write explanation here
* {@link com.example.uddhav.memoryuse.MyInterface}
* I provided absolute reference of MyInterface here
*/
public void printHello(String str); /* your method */
在实现接口的 class 上,您 右键单击 > 生成 > 覆盖方法 > 检查 "copy javadoc"。
示例:
界面
public interface MyInterface {
/**
* {@inheritDoc}
* {@link com.example.uddhav.memoryuse.MyInterface}
* This printHello method is ..........
*/
public void printHello(String str);
/**
* {@inheritDoc}
* This printUddhav method is ..........
*/
public void printUddhav(String strr);
public void printGautam(String strr);
}
Class:
public class MainActivity extends AppCompatActivity implements MyInterface{
/* right click > generate > override methods > copy JavaDoc */
/* you are done */
/* I generated these below */
/**
* {@inheritDoc}
* {@link MyInterface}
* This printHello method is ..........
*
* @param str
*/
@Override
public void printHello(String str) {
}
/**
* {@inheritDoc}
* This printUddhav method is ..........
*
* @param strr
*/
@Override
public void printUddhav(String strr) {
}
@Override
public void printGautam(String strr) {
}
点击myInterface,您将被重定向到您在界面上的方法。