Class KeyValueSizeConstraints

java.lang.Object
org.springframework.shell.table.KeyValueSizeConstraints
All Implemented Interfaces:
SizeConstraints

public class KeyValueSizeConstraints extends Object implements SizeConstraints
A SizeConstraints implementation that is tailored to rendering a series of key = value pairs. Computes extents so that equal signs (or any other configurable delimiter) line up vertically.
  • Constructor Details

    • KeyValueSizeConstraints

      public KeyValueSizeConstraints(String delimiter)
  • Method Details

    • width

      public SizeConstraints.Extent width(String[] raw, int tableWidth, int nbColumns)
      Specified by:
      width in interface SizeConstraints
      Parameters:
      raw - the raw String representation of the cell contents (may be reformatted later, eg wrapped)
      tableWidth - the whole available width for the table
      nbColumns - the number of columns in the table
      Returns:
      the minimum and maximum width of the cell, given its raw content.