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
Modifier and TypeClassDescriptionstatic enum
Represents the alignment value used for columns in aTable
-
Constructor Summary
-
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 beCENTER
Methods inherited from class org.tealeaf.javamarkdown.types.Structure
checkType, requiresNewlineAfter, requiresNewlineBefore
Methods inherited from class org.tealeaf.javamarkdown.MarkdownElement
asString, toAppendable, toString, toWriter
-
Constructor Details
-
Table
public Table()Creates a new
Table
object- 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
IllegalAlignmentCountException
if 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:
asString
in classMarkdownElement
- Returns:
- String representation of the formatted item
- Since:
- 0.0.18
-