Package org.apache.commons.cli.help

# Interface TableDefinition

public interface TableDefinition
The definition of a table to display.

Aa table definition contains a caption and data that describes each column. Every column in the table may have

- A caption.
- A `TextStyle` that describes the width of the entry, its offset from the previous column (leftPad) and how much each line after the first should be indented (indent).
- A heading (String) is placed at the top of the column
- A collection of rows

Since:
  1.10.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `caption()`
  Gets the caption for the table.
  `List<TextStyle>`
  `columnTextStyles()`
  Gets the list TextStyles.
  `static TableDefinition`
  `from(String caption, List<TextStyle> columnStyle, List<String> headers, Iterable<List<String>> rows)`
  A helper function to create a table instance from the various components.
  `List<String>`
  `headers()`
  Gets the list of header strings.
  `Iterable<List<String>>`
  `rows()`
  Gets the collection of rows.

- ## Method Details

  - ### from

    static TableDefinition from(String caption, List<TextStyle> columnStyle, List<String> headers, Iterable<List<String>> rows)
    A helper function to create a table instance from the various components.
    Parameters:
      `caption` - The caption, may be `null`.
      `columnStyle` - a list of TextStyle elements defining the columns.
      `headers` - the list of column headers.
      `rows` - a collection of rows.
    Returns:
      A TableDefinition returning the parameters as appropriate.

  - ### caption

    String caption()
    Gets the caption for the table. May be @{code null}.
    Returns:
      The caption for the table. May be @{code null}.

  - ### columnTextStyles

    List<TextStyle> columnTextStyles()
    Gets the list TextStyles. One for each column in order.
    Returns:
      the list of TextStyles.

  - ### headers

    List<String> headers()
    Gets the list of header strings. One for each column in order.
    Returns:
      The list of header strings.

  - ### rows

    Iterable<List<String>> rows()
    Gets the collection of rows.

    Each row is a list of Strings, one for each column in the table.

    Returns:
      The collection of rows.