Links¶

Roles in your pages¶

Roles take fully qualified names. Overloaded methods need their erased parameter types; constructors are named <init>.

You write

You get

:java:type:`demo.Widget`

demo.Widget

:java:type:`demo.Widget.Nested`

demo.Widget.Nested

:java:method:`demo.Widget#convert(int)`

demo.Widget#convert(int)

:java:method:`demo.Widget#<init>(java.lang.String)`

demo.Widget#<init>(java.lang.String)

:java:field:`demo.Widget#LABEL`

demo.Widget#LABEL

:java:package:`demo`

demo

:java:obj:`demo.Mode#FAST`

demo.Mode#FAST

Links in comments¶

{@link} and {@linkplain} targets are resolved by the compiler, with the comment’s own imports, and become native references. See the class comment on the Javadoc comments page.

External Javadoc¶

Types outside your sources, such as java.time.Instant in demo.Point, link to the Javadoc site mapped in java_external_javadoc. Links to members use the same anchors as the standard doclet.

Other Sphinx sites¶

Every documented declaration is in this site’s objects.inv, so other Sphinx projects can link to it through sphinx.ext.intersphinx. This documentation links to the Commons Lang showcase that way, for example org.apache.commons.lang3.StringUtils.

Source links¶

With sphinx.ext.linkcode and a linkcode_resolve function, each declaration gets a [source] link. This site links to the fixture’s files on GitHub. For the java domain, info holds:

fullname

The canonical ID, such as demo.Widget#convert(int).

source

The file relative to its source root, such as demo/Widget.java. Nested types and members point into their top-level type’s file.

line

The declaration’s first line, including annotations. It is empty for compiler-generated members such as Mode.values().

See Source links for the configuration.

Java autodoc

Navigation

Publish your documentation

  • Publish your first API pages
  • Write a guide your users can follow
  • Build with dependencies and CI

Reference and help

  • Configuration and reference
  • Supported Javadoc
  • Compatibility and limits
  • Performance measurements
  • Troubleshoot a documentation build
  • Choosing a tool

Live examples

  • Feature gallery
  • Java API: Apache Commons Lang

Project internals

  • How it works

Related Topics

  • Documentation overview
    • Feature gallery
      • Previous: Directives in your own pages
      • Next: What produces a warning
©. | Powered by Sphinx 9.1.0 & Alabaster 1.0.0 | Page source