可以在IntelliJ Idea中超链接评论吗?

时间:2012-12-08 14:56:56

标签: java android intellij-idea

我正在使用IntelliJ Idea for Android devleopment。有什么方法可以在IDE中超链接两个注释。例如

档案 a.java

import a;

/**
* This class does something and something
* and does implements interface b, 
* (i want a hyperlink here, if pressed opens file b.java in IDE and cursor is at comments        
*  before method n)
*/

public class a {
  //do something
}

档案 b.java

import k;

public interface b {

   public j;
   public m;
   /**
    * This will be used when this and this will happen.
   */  
   public n;
}

3 个答案:

答案 0 :(得分:16)

您可以使用Javadocs'@see标记 - 示例here

做这样的事情就足够了:

/**
* Bla bla bla
* @see b#n
*/
public class a

答案 1 :(得分:5)

当前的IntelliJ版本支持@link表示法,就像Eclipse一样。

要链接到另一个类/方法,只需使用此模式:

/**
 * {@link Class#method}
 */
public void myMethod() {
}

你也可以省去方法,或者在方法中添加一个参数类型列表(在括号中),如果一个方法用不同的参数实现并且你想链接到一个特定的方法,那么这个方法很有用。

答案 2 :(得分:1)

您可以只使用方括号,格式为:[class.method]。对于您的示例,它将如下所示:

/**
* This class does something and something
* and does implements interface [b.n]
*/