Class Table

java.lang.Object
org.springframework.shell.table.Table
All Implemented Interfaces:
TerminalSizeAware

public class Table extends Object implements TerminalSizeAware
This is the central API for table rendering. A Table object is constructed with a given TableModel, which holds raw table contents. Its rendering logic is then altered by applying various customizations, in a fashion very similar to what is used e.g. in a spreadsheet program:
  1. formatters know how to derive character data out of raw data. For example, numbers are formatted according to a Locale, or Maps are emitted as a series of key=value lines
  2. size constraints are then applied, which decide how much column real estate to allocate to cells
  3. text wrapping policies are applied once the column sizes are known
  4. finally, alignment strategies actually render text as a series of space-padded strings that draw nicely on screen.
All those customizations are applied selectively on the Table cells thanks to a CellMatcher: One can decide to right pad column number 3, or to format in a certain way all instances of java.util.Map.

Of course, all of those customizations often work hand in hand, and not all combinations make sense: one needs to anticipate the fact that text will be split using the ' ' (space) character to properly calculate column sizes.