Moritz
Moritz

Reputation: 1125

Javadoc: link to method with default argument

I have two method, where one method is a simple proxy for the other with some default argument:

/**
 * do the foo
 * @param bar preprocess object baz
 * @param baz the object we are working on
 */
public void foo(boolean bar, Object baz) {}

/**
 * do the foo, with preprocessing.
 * See {@link #foo(boolean, Object)}
 * @param baz the object we are working on
 */
public void foo(Object baz) {
    foo(true, baz);
}

Here, the second method foo(Object) is a convenience shortcut for *foo('true', Object).

Q: How can I state this in javadoc? I mean replacing "See {@link #foo(boolean, Object)}" with something like {@link #foo(true, Object)? (The latter version however is syntactically incorrect.)

Upvotes: 0

Views: 127

Answers (1)

Lolo
Lolo

Reputation: 4347

THe @link construct allows you to display arbitrary text while still linking to the proper Java element:

/**
 * do the foo, with preprocessing.
 * See {@link #foo(boolean, Object) foo(true, Object)}
 * @param baz the object we are working on
 */
public void foo(Object baz) {
    foo(true, baz);
}

Upvotes: 1

Related Questions