Javadoc Output Example
On this page
Javadoc Output Example
A real example of what bxSitesJavadocDoc (Gradle) / bxsites:javadoc
(Maven) actually produces - see
Gradle Plugin or
Maven Plugin for how to turn
this on in your own project.
Point it at your own project's .java sources and it walks every public
top-level type, emitting one page per type, its constructors/methods/fields
wrapped in a small Alpine.js-driven filter toolbar - a search box plus one
chip per kind actually present - so a long class stays easy to scan. Given
this class:
package com.example;
/**
* A single book in the shelf, immutable once created. Two books are
* considered equal only by reference, not by content.
*/
public class Book {
/** The longest title this shelf will accept. */
public static final int MAX_TITLE_LENGTH = 200;
/**
* Creates a book with the given title and author.
*
* @param title the book's title
* @param author the book's author
*/
public Book(String title, String author) {
this.title = title;
this.author = author;
}
/**
* Returns a copy of this book with a new title.
*
* @param newTitle the new title
* @return a copy of this book with the given title
*/
public Book withTitle(String newTitle) {
return new Book(newTitle, author);
}
}
...the generator writes api/javadoc/com/example/Book.md with this
frontmatter:
---
title: "Book"
summary: "A single book in the shelf, immutable once created."
tags: [api, javadoc]
---
And this body, reproduced below not as a code block but rendered for real - this is the generated page's actual body, live, including the filter toolbar. Try the Fields chip, or type "title" into the search box:
Book
com.example.Book
A single book in the shelf, immutable once created. Two books are considered equal only by reference, not by content.
Notice the class's first sentence became the frontmatter summary, while
the page body carries the full doc comment (both sentences) - that's real
DocCommentTree first-sentence extraction, not a simplification made for
this example. Notice too that the toolbar/chips/search box above are real,
working Alpine.js - not a screenshot - built entirely from plain HTML
attributes and a small inline stylesheet driven by this theme's own
--bxsites-* variables, so it looks right in whichever theme you're
reading this in without bx-sites itself needing any changes.
What this doesn't cover
Deliberately scoped down for v1, not a complete Javadoc-to-Markdown
converter - this is the heaviest of the three Spring Boot generators.
Nested and package-private types are skipped entirely; only each member's
own doc comment is used, never an inherited one; inline HTML in doc
comments is stripped rather than converted to Markdown; {@link}/{@see}
render as inline code with no cross-page hyperlink resolution; no
index/nav page is generated. A record also picks up its
compiler-generated accessors/toString/equals/hashCode, matching the
standard javadoc tool's own behavior - Book above is a plain class so
this example stays focused on the common case. See the Gradle/Maven guides
linked above for the full list.