public final class DocumentationBuilder extends Object
Constructor and Description |
---|
DocumentationBuilder() |
Modifier and Type | Method and Description |
---|---|
DocumentationBuilder |
asyncThrows(List<Pair<String,String>> exceptions)
Adds multiple async throws to the Javadoc for each exception name / exception doc pair.
|
DocumentationBuilder |
asyncThrows(Pair<String,String>... exceptions)
Adds multiple async throws to the Javadoc for each exception name / exception doc pair.
|
DocumentationBuilder |
asyncThrows(String exceptionClass,
String exceptionDoc)
Async exceptions are not thrown from the method, rather the returned
CompletableFuture is
completed exceptionally (CompletableFuture.completeExceptionally(Throwable) . |
String |
build()
Builds the Javadoc string with the current configuration.
|
DocumentationBuilder |
description(String docs)
Description of javaodc comment.
|
DocumentationBuilder |
param(String paramName,
String paramDocs)
Adds a new param to the Javadoc.
|
DocumentationBuilder |
param(String paramName,
String paramDocs,
Object... formatArgs)
Adds a new param to the Javadoc.
|
DocumentationBuilder |
returns(String returnsDoc)
Adds documentation for return value.
|
DocumentationBuilder |
returns(String returnsDoc,
Object... formatArgs)
Adds documentation for return value.
|
DocumentationBuilder |
see(String seeLink)
Adds a @see reference to the Javadocs.
|
DocumentationBuilder |
see(String seeLink,
Object... formatArgs)
Adds a @see reference to the Javadocs.
|
DocumentationBuilder |
syncThrows(List<Pair<String,String>> exceptions)
Adds multiple throws tag to the Javadoc for each exception name / exception doc pair.
|
DocumentationBuilder |
syncThrows(Pair<String,String>... exceptions)
Adds multiple throws tag to the Javadoc for each exception name / exception doc pair.
|
DocumentationBuilder |
syncThrows(String exceptionClass,
String exceptionDoc)
Adds a throws tag to the Javadoc.
|
DocumentationBuilder |
tag(String tagName,
String... tagValues)
Adds an arbitrary tag with values to the Javadoc.
|
public DocumentationBuilder description(String docs)
docs
- Description stringpublic DocumentationBuilder param(String paramName, String paramDocs)
paramName
- Name of parameter.paramDocs
- Documentation for parameter.public DocumentationBuilder param(String paramName, String paramDocs, Object... formatArgs)
String.format(String, Object...)
using the given arguments.paramName
- Name of parameter.paramDocs
- Documentation for parameter.formatArgs
- Arguments referenced by format specifiers.public DocumentationBuilder returns(String returnsDoc)
returnsDoc
- Documentation for return value (if present).public DocumentationBuilder returns(String returnsDoc, Object... formatArgs)
String.format(String, Object...)
using the given arguments.returnsDoc
- Documentation for return value (if present).formatArgs
- Arguments referenced by format specifiers.public DocumentationBuilder asyncThrows(String exceptionClass, String exceptionDoc)
CompletableFuture
is
completed exceptionally (CompletableFuture.completeExceptionally(Throwable)
. Because of this
we don't add @throws to the Javadocs or method signature for async methods, we instead add a list of exceptions the future
may be completed exceptionally with in the @returns section of the Javadoc.exceptionClass
- Class name of thrown exception.exceptionDoc
- Documentation for thrown exception.public DocumentationBuilder asyncThrows(Pair<String,String>... exceptions)
exceptions
- Multiple pairs of exception name to exception documentation.asyncThrows(String, String)
public DocumentationBuilder asyncThrows(List<Pair<String,String>> exceptions)
exceptions
- Multiple pairs of exception name to exception documentation.asyncThrows(String, String)
public DocumentationBuilder syncThrows(String exceptionClass, String exceptionDoc)
exceptionClass
- Class name of thrown exception.exceptionDoc
- Documentation for thrown exception.public DocumentationBuilder syncThrows(Pair<String,String>... exceptions)
exceptions
- Multiple pairs of exception name to exception documentation.syncThrows(String, String)
public DocumentationBuilder syncThrows(List<Pair<String,String>> exceptions)
exceptions
- Multiple pairs of exception name to exception documentation.syncThrows(String, String)
public DocumentationBuilder tag(String tagName, String... tagValues)
tagName
- Name of tag to add.tagValues
- List of values associated with the same.public DocumentationBuilder see(String seeLink)
seeLink
- Reference for @see.public DocumentationBuilder see(String seeLink, Object... formatArgs)
String.format(String, Object...)
using the given arguments.seeLink
- Reference for @see.formatArgs
- Arguments referenced by format specifiers.public String build()
Copyright © 2023. All rights reserved.