简体   繁体   English

在JavaDocs中显示数组值

[英]Show Array Value in JavaDocs

Lets say I have got such code: 可以说我有这样的代码:

private static final int[] ARRAY = {5, 10, 15};

/**
 * ????
 */
public void doSomething()
{}

I am wondering, if is there any way to put value of the ARRAY into documentation of doSomething() method. 我想知道,是否有任何方法可以将ARRAY的值放入doSomething()方法的文档中。 I can see that @value #ARRAY isn't working at all for arrays :( @link #ARRAY is not showing me the value. 我可以看到@value #ARRAY对于数组根本不起作用:( @link #ARRAY没有向我显示该值。

Am I missing something? 我想念什么吗?

The problem is that @value only works for constants, ie static final values. 问题是@value仅适用于常量,即static final值。 The array contents are not constants, only the array object itself is. 数组内容不是常量,只有数组对象本身是常量。 You can change the values at any time. 您可以随时更改值。 So it doesn't make sense, technically, to show the values. 因此,从技术上讲,显示这些值没有意义。 The array object itself can't be shown at Javadoc creation time in any useful way, like any other object (except String s). 数组对象本身无法以任何有用的方式在Javadoc创建时显示,就像其他任何对象( String除外)一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM