Class Table


public class Table extends Structure

Renders a Table in Markdown, including Headers and row-by-row contents

Since:
0.0.18
Author:
Thomas Kwashnak
  • Constructor Details

    • Table

      public Table()

      Creates a new Table object

      Since:
      0.0.18
  • Method Details

    • setHeaders

      public Table setHeaders(Object... headers)

      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

      public Table setAlignments(Table.Alignment... alignments)

      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

      public Table addRows(Object[]... rows)
      Adds rows of content to the table
      Parameters:
      rows - Arrays of cell contents for each row
      Returns:
      This table
      Since:
      0.0.18
    • asString

      public String asString()
      Formats the element to a string
      Specified by:
      asString in class MarkdownElement
      Returns:
      String representation of the formatted item
      Since:
      0.0.18