@see, привязать методы других классов
Скажем, например, что я хочу связать метод java.lang.Double с тегом html:
@see <a href="#" onclick="location.href='http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/Double.html#equals(java.lang.Object)'; return false;">
Это нормально, но я не понял, как связать нестандартный класс.
Например, я разрабатываю два класса под названием AbstractVehicle и Vehicle.But, нет документации Abstractavationalle javadoc, потому что документация еще должна быть сгенерирована.
Тогда как мне связать его метод или ссылку на класс? Рассмотрим это:
@see mypackage.AbstractVehilce
Это не помещает URL-адрес класса, я бы знал, как получить URL-адрес или ссылку на него, прежде чем создавать документацию.
Надеюсь, что вопрос ясен, скажите мне иначе.
Ответы
Ответ 1
Чтобы создать link для определенного класса, вы можете использовать тег {@link mypackage.AbstractVehicle}
. Аналогично, вы можете использовать {@link mypackage.AbstractVehicle#someMethod}
для создания ссылки на someMethod()
в классе AbstractVehicle
.
Более подробные рекомендации javadoc можно найти в Oracle javadoc - страница разработчика документации API Java.
Ответ 2
В manpage для javadoc объясняются -link
и -linkoffline
, которые управляют тем, как создаются ссылки для пакетов, не переданных в javadoc
.
-link extdocURL
Creates links to existing javadoc-generated documentation
of external referenced classes. It takes one argument.
extdocURL is the absolute or relative URL of the directory
containing the external javadoc-generated documentation
you want to link to. Examples are shown below. The pack-
age-list file must be found in this directory (otherwise,
use -linkoffline). The Javadoc tool reads the package
names from the package-list file and then links to those
packages at that URL. When the Javadoc tool is run, the
extdocURL value is copied literally into the <A HREF>
links that are created. Therefore, extdocURL must be the
URL to the directory, not to a file.
You can use an absolute link for extdocURL to enable your
docs to link to a document on any website, or can use a
relative link to link only to a relative location. If rel-
ative, the value you pass in should be the relative path
from the destination directory (specified with -d ) to the
directory containing the packages being linked to.
When specifying an absolute link you normally use an http:
link. However, if you want to link to a file system that
has no web server, you can use a file: link - however, do
this only if everyone wanting to access the generated doc-
umentation shares the same file system.
You can specify multiple -link options in a given javadoc
run to link to multiple documents.
Choosing between -linkoffline and -link - One or the other
option is appropriate when linking to an API document that
is external to the current javadoc run.
Use -link: when using a relative path to the external API
document, or when using an absolute URL to the external
API document, if you shell does not allow a program to
open a connection to that URL for reading.
Use -linkoffline : when using an absolute URL to the
external API document, if your shell does not allow a pro-
gram to open a connection to that URL for reading. This
can occur if you are behind a firewall and the document
you want to link to is on the other side.
...
и в то время как -link
требует, чтобы вы подключались к сети при создании документации, чтобы получить список пакетов по сети, -linkoffline
не требует, чтобы вы сами поставляли список пакетов:
-linkoffline extdocURL packagelistLoc
This option is a varition of -link; they both create links
to javadoc-generated documentation for external referenced
classes. Use the -linkoffline option when linking to a
document on the web when the Javadoc tool itself is
"offline" - that is, it cannot access the document through
a web connection.
...
Ответ 3
То, что вы можете положить после @see
, описано в документации инструмента javadoc. Вы никогда не должны ставить URL-адрес какого-либо внешнего класса или документации метода. Вместо этого вы должны поместить имя класса/метода и использовать опцию -, чтобы javadoc вычислил соответствующий URL-адрес для вас.