Directives in your own pages

Generated pages are optional. These directives put Java documentation anywhere in a handwritten page. Each example shows the reStructuredText and its result. See Configuration and reference for every option.

A type with selected members

:members: takes entries separated by semicolons, so overloads can include their parameter types. A bare name selects every overload.

.. java:autoclass:: demo.Widget
   :members: convert(int); LABEL; count
   :visibility: public
   :no-index:
public class demo.Widget implements Transformer<String>[source]

A widget with a unified Java API and handwritten guides.

Call #convert(int) or the text overload. Types such as Instant, java.util.Map.Entry, and String#substring(int, int) link to configured external Javadoc.

  • Preserves structure and emphasis.

  • Supports nested lists:

    1. Read.

    2. Transform.

Widget widget = new Widget();
 String result = widget.convert(42);
 if (result.length() > 0) {
     System.out.println(result);
 }
First line
Second line
Third line
Last line.

Try query parameters.

An inline snippet:

    String value = widget.convert(7);
    System.out.println(value);
Conversion examples

Call

Result

Notes

widget.convert(42)

"42"

Labelled "widget"; long names such as com.example.widgets.configuration.DefaultWidgetLabelProvider stay inside the table

See also:

Point

Since:

1.0

Fields and constants

public static final String LABEL = "widget"[source]

Default label.

Methods

public String convert(int number)[source]

Converts a number to text.

Parameters:

number – the number

Returns:

decimal text

count is protected, so :visibility: public leaves it out.

All members but some

An empty :members: selects every member; :exclude-members: removes some.

.. java:autoclass:: demo.Mode
   :members:
   :exclude-members: values; valueOf
   :no-index:
public final enum demo.Mode[source]

Execution mode.

Fields and constants

public static final Mode CAREFUL[source]

Careful processing.

public static final Mode FAST[source]

Quick processing.

Methods

public boolean isFast()[source]

Returns whether this mode is fast.

Returns:

true for fast mode

A single member

.. java:autofield:: demo.Widget#LABEL
   :no-index:
public static final String LABEL = "widget"[source]

Default label.

A summary table

java:autosummary lists packages, types or members with links and their first sentences, like sphinx.ext.autosummary.

.. java:autosummary::

   demo
   demo.Widget
   demo.Shape
   demo.Widget#convert(int)

demo

Example API.

Widget

A widget with a unified Java API and handwritten guides.

Shape

Something with a position; only Point implements it.

convert(int)

Converts a number to text.

Package documentation

java:autopackage renders the comment in package-info.java. The generated demo page uses it.

.. java:autopackage:: demo