Class KeyValueTextWrapper

java.lang.Object
org.springframework.shell.table.KeyValueTextWrapper
All Implemented Interfaces:
TextWrapper

public class KeyValueTextWrapper extends Object implements TextWrapper
A TextWrapper implementation tailored for key-value rendering (working in concert with KeyValueSizeConstraints, KeyValueHorizontalAligner), that tries its best to vertically align some delimiter character (default '=').
  • Constructor Details

    • KeyValueTextWrapper

      public KeyValueTextWrapper()
    • KeyValueTextWrapper

      public KeyValueTextWrapper(String delimiter)
  • Method Details

    • wrap

      public String[] wrap(String[] original, int columnWidth)
      Specified by:
      wrap in interface TextWrapper
      Parameters:
      original - the text in its original form
      columnWidth - the width to conform to
      Returns:
      a list of lines where each line length MUST be equal to columnWidth (padding with spaces if appropriate). There is no constraint on the number of lines returned however (typically, will be greater than the input number if wrapping occurred).