반응형
javadoc에서 메소드 매개 변수에 대한 참조를 추가하는 방법은 무엇입니까?
메소드 문서 본문에서 하나 이상의 메소드 매개 변수에 대한 참조를 추가하는 방법이 있습니까? 다음과 같은 것 :
/**
* When {@paramref a} is null, we rely on b for the discombobulation.
*
* @param a this is one of the parameters
* @param b another param
*/
void foo(String a, int b)
{...}
javadoc에 대한 문서를 읽은 후에 알 수있는 한 그러한 기능은 없습니다.
<code>foo</code>
다른 답변에서 권장 하는 대로 사용하지 마십시오 . 사용할 수 있습니다 {@code foo}
. 이것은 {@code Iterator<String>}
다음 과 같은 일반적인 유형을 참조 할 때 특히 유용 <code>Iterator<String></code>
합니다.
java.lang.String 클래스의 Java 소스에서 볼 수 있듯이
/**
* Allocates a new <code>String</code> that contains characters from
* a subarray of the character array argument. The <code>offset</code>
* argument is the index of the first character of the subarray and
* the <code>count</code> argument specifies the length of the
* subarray. The contents of the subarray are copied; subsequent
* modification of the character array does not affect the newly
* created string.
*
* @param value array that is the source of characters.
* @param offset the initial offset.
* @param count the length.
* @exception IndexOutOfBoundsException if the <code>offset</code>
* and <code>count</code> arguments index characters outside
* the bounds of the <code>value</code> array.
*/
public String(char value[], int offset, int count) {
if (offset < 0) {
throw new StringIndexOutOfBoundsException(offset);
}
if (count < 0) {
throw new StringIndexOutOfBoundsException(count);
}
// Note: offset or count might be near -1>>>1.
if (offset > value.length - count) {
throw new StringIndexOutOfBoundsException(offset + count);
}
this.value = new char[count];
this.count = count;
System.arraycopy(value, offset, this.value, 0, count);
}
매개 변수 참조는 <code></code>
태그로 묶여 있습니다. 즉, Javadoc 구문은 이러한 작업을 수행 할 수있는 방법을 제공하지 않습니다. (String.class는 javadoc 사용법의 좋은 예라고 생각합니다).
메소드 매개 변수를 참조하는 올바른 방법은 다음과 같습니다.
이 동작을 지원하기 위해 자신의 독렛이나 태그를 작성할 수 있다고 생각합니다.
참고 : https://stackoverflow.com/questions/1667212/how-to-add-reference-to-a-method-parameter-in-javadoc
반응형
'development' 카테고리의 다른 글
정수가 다른 두 정수 사이에 있는지 확인 (0) | 2020.03.15 |
---|---|
div가 표시 될 때 작업을 트리거하는 jQuery 이벤트 (0) | 2020.03.15 |
Java에서 함수 포인터를 대체하는 가장 가까운 것은 무엇입니까? (0) | 2020.03.15 |
GitHub가 SSH를 통한 HTTPS를 권장하는 이유는 무엇입니까? (0) | 2020.03.14 |
“.NET Core”란 무엇입니까? (0) | 2020.03.14 |