Package org.springframework.shell.support.table

Examples of org.springframework.shell.support.table.Table


   * @param rows    rows of the table, each value will be added as a new row with the same key
   * @param headers headers of the table
   * @return formatted table
   */
  public static String renderMultiValueMap(Map<String, List<String>> rows, String... headers) {
    Table table = createTable(headers);
    if (rows != null) {
      for (String key : rows.keySet()) {
        List<String> values = rows.get(key);
        if (values != null) {
          for (String value : values) {
            table.addRow(key, value);
          }
        }
      }
    }
    return format(table);
View Full Code Here


   * @param rows    rows of the table, value map will be added as the last 2 columns to the table
   * @param headers headers of the table
   * @return formatted table
   */
  public static String renderMapValueMap(Map<String, Map<String, String>> rows, String... headers) {
    Table table = createTable(headers);
    if (rows != null) {
      for (String key1 : rows.keySet()) {
        Map<String, String> values = rows.get(key1);
        if (values != null) {
          for (String key2 : values.keySet()) {
            table.addRow(key1, key2, values.get(key2));
          }
        }
      }
    }
    return format(table);
View Full Code Here

    }
    return format(table);
  }

  private static Table createTable(String... headers) {
    Table table = new Table();
    if (headers != null) {
      int column = 1;
      for (String header : headers) {
        table.addHeader(column++, new TableHeader(header));
      }
    }
    return table;
  }
View Full Code Here

TOP

Related Classes of org.springframework.shell.support.table.Table

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.