Package io.github.sandydunlop.markista.markdown
Class TypeWriter
java.lang.Object
io.github.sandydunlop.markista.markdown.TypeWriter
public class TypeWriter
A class that outputs API type documentation as Markdown.
Field Summary
| Modifier and Type | Field | Description |
|---|---|---|
| private static final String | BR | |
| private static final String | NBSP | |
| private static final String | TEXT_CLASS | |
| private static final String | TEXT_DESCRIPTION | |
| private static final String | TEXT_MODIFIER_AND_TYPE | |
| private Context | ctx | The Context singleton instance providing access to the current documentation generation context, including configuration, current module/package/type names, and reporting utilities. |
| private Writer | writer | The Writer used to output the generated markdown content for the current document. |
Constructor Summary
| Constructor | Description |
|---|---|
| TypeWriter(Context context) | Constructor that sets up the locations API documents will be written to. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
| public void | outputTypeDoc(TypeNode typeNode) | Writes a Markdown file for the Javadoc of a type |
| private void | outputSupertypes(TypeNode typeNode) | Outputs the hierarchy of supertypes of a class |
| private void | outputImplementedInterfaces(TypeNode typeNode) | Outputs details of any interfaces that this class implements |
| private void | outputEnclosingClass(TypeNode typeNode) | Outputs details of the class that encloses this one |
| private void | outputAllKnownImplementingClasses(TypeNode typeNode) | |
| private void | outputDirectKnownSubtypes(TypeNode typeNode) | |
| private void | outputDeclaration(TypeNode typeNode) | Outputs the type declaration |
| private void | outputMethodOrFieldDeclaration(AbstractMember member) | Outputs the type declaration |
| private String | createAnnotationString(AppliedAnnotationNode annotation) | Creates a string of the elements within an annotation |
| private void | outputNestedClassSummary(List<TypeNode> nestedClasses) | Outputs a summary of nested classes within this one as Markdown |
| private void | outputEnumConstantsSummary(EnumNode enumNode) | Outputs as summary of an enum's constants as Markdown |
| private void | outputFieldSummary(List<FieldNode> fields) | Outputs a summary of this class's fields as Markdown |
| private void | outputConstructorSummary(List<MethodNode> methods) | Outputs a the summary of this class's constructors as Markdown |
| private void | outputMethodSummary(List<MethodNode> methods) | Writes the markdown for a class's method summary table |
| private void | outputEnumConstantDetails(List<FieldNode> constants) | Outputs enum constant details as Markdown |
| private void | outputDetails(List<Node> nodes) | Writes the markdown for a class's method or field details. |
| private void | outputReferences(Node node) | Outputs references for a type member |
| private void | outputMethodDetails(MethodNode method) | Outputs the Javadoc of a method as Markdown |
| private void | outputMethodParams(MethodNode method) | Outputs the parameters of a method as Markdown |
| private void | outputDeprecation(Deprecation status, Text text) | Outputs the deprecation status of this type as Markdown |
| private void | outputInheritedMethods(TypeNode typeNode) |
Field Details
BR
private static final String BR
See Also:
NBSP
private static final String NBSP
TEXT_CLASS
private static final String TEXT_CLASS
See Also:
TEXT_DESCRIPTION
private static final String TEXT_DESCRIPTION
See Also:
TEXT_MODIFIER_AND_TYPE
private static final String TEXT_MODIFIER_AND_TYPE
See Also:
ctx
private Context ctx
The Context singleton instance providing access to the current documentation generation context,
including configuration, current module/package/type names, and reporting utilities.> Warning
Do not make this final. It will break tests with mocked Context.
writer
private Writer writer
The Writer used to output the generated markdown content for the current document.It handles writing text to the appropriate output file or stream.
Method Details
outputTypeDoc
public void outputTypeDoc(TypeNode typeNode)
Writes a Markdown file for the Javadoc of a type
Parameters:
typeNode - the type
Throws:
InvalidPathException , IOException
outputSupertypes
private void outputSupertypes(TypeNode typeNode)
Outputs the hierarchy of supertypes of a class
Parameters:
typeNode - the class
Throws:
outputImplementedInterfaces
private void outputImplementedInterfaces(TypeNode typeNode)
Outputs details of any interfaces that this class implements
Parameters:
typeNode - a TypeNode representing a class, interface, enum, or annotation
Throws:
outputEnclosingClass
private void outputEnclosingClass(TypeNode typeNode)
Outputs details of the class that encloses this one
Parameters:
typeNode - a TypeNode representing the enclosing class
Throws:
outputAllKnownImplementingClasses
private void outputAllKnownImplementingClasses(TypeNode typeNode)
Throws:
outputDirectKnownSubtypes
private void outputDirectKnownSubtypes(TypeNode typeNode)
Throws:
outputDeclaration
private void outputDeclaration(TypeNode typeNode)
Outputs the type declaration
Parameters:
typeNode - the type being documented
Throws:
outputMethodOrFieldDeclaration
private void outputMethodOrFieldDeclaration(AbstractMember member)
Outputs the type declaration
Throws:
createAnnotationString
private String createAnnotationString(AppliedAnnotationNode annotation)
Creates a string of the elements within an annotation
Parameters:
annotation - the annotation
Returns:
The string
outputNestedClassSummary
private void outputNestedClassSummary(List<TypeNode> nestedClasses)
Outputs a summary of nested classes within this one as Markdown
Parameters:
nestedClasses - a list of the nested classes
Throws:
outputEnumConstantsSummary
private void outputEnumConstantsSummary(EnumNode enumNode)
Outputs as summary of an enum's constants as Markdown
Parameters:
enumNode - the enum
Throws:
outputFieldSummary
private void outputFieldSummary(List<FieldNode> fields)
Outputs a summary of this class's fields as Markdown
Parameters:
fields - A list of fields belonging to this class
Throws:
outputConstructorSummary
private void outputConstructorSummary(List<MethodNode> methods)
Outputs a the summary of this class's constructors as Markdown
Parameters:
methods - A list of the constructor methods
Throws:
outputMethodSummary
private void outputMethodSummary(List<MethodNode> methods)
Writes the markdown for a class's method summary table
Parameters:
methods - The list of methods to include in the summary table
Throws:
outputEnumConstantDetails
private void outputEnumConstantDetails(List<FieldNode> constants)
Outputs enum constant details as Markdown
Parameters:
constants - a list of enum constants
Throws:
outputDetails
private void outputDetails(List<Node> nodes)
Writes the markdown for a class's method or field details.
Parameters:
nodes - The list of methods to write the details of
Throws:
Since:
0.1.0
See Also:
outputReferences
private void outputReferences(Node node)
Outputs references for a type member
Parameters:
node - The type
Throws:
outputMethodDetails
private void outputMethodDetails(MethodNode method)
Outputs the Javadoc of a method as Markdown
Parameters:
method - the method
Throws:
outputMethodParams
private void outputMethodParams(MethodNode method)
Outputs the parameters of a method as Markdown
Parameters:
method - the method
Throws:
outputDeprecation
private void outputDeprecation(Deprecation status, Text text)
Outputs the deprecation status of this type as Markdown
Parameters:
status - The deprecation status
text - A textual description of the deprecation status
Throws:
outputInheritedMethods
private void outputInheritedMethods(TypeNode typeNode)
Throws: