Class Table
java.lang.Object
org.tealeaf.javamarkdown.MarkdownElement
org.tealeaf.javamarkdown.types.Structure
org.tealeaf.javamarkdown.elements.Table
Renders a Table in Markdown, including Headers and row-by-row contents
- Since:
- 0.0.18
- Author:
- Thomas Kwashnak
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents the alignment value used for columns in aTable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds rows of content to the tableasString()Formats the element to a stringsetAlignments(Table.Alignment... alignments) Sets the alignments for the tablesetHeaders(Object... headers) Sets the headers and defaults the alignments to all beCENTERMethods inherited from class org.tealeaf.javamarkdown.types.Structure
checkType, requiresNewlineAfter, requiresNewlineBeforeMethods inherited from class org.tealeaf.javamarkdown.MarkdownElement
asString, toAppendable, toString, toWriter
-
Constructor Details
-
Table
public Table()Creates a new
Tableobject- Since:
- 0.0.18
-
-
Method Details
-
setHeaders
Sets the headers and defaults the alignments to all be
CENTER- Parameters:
headers- Array of header objects- Returns:
- This table
- Since:
- 0.0.18
-
setAlignments
Sets the alignments for the table
Throws
IllegalAlignmentCountExceptionif the number of alignments does not match the number of headers- Parameters:
alignments- Column alignments in order- Returns:
- This table
-
addRows
Adds rows of content to the table- Parameters:
rows- Arrays of cell contents for each row- Returns:
- This table
- Since:
- 0.0.18
-
asString
Formats the element to a string- Specified by:
asStringin classMarkdownElement- Returns:
- String representation of the formatted item
- Since:
- 0.0.18
-