org.springframework.yarn.support.console.UiUtils Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.yarn.support.console;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.commons.lang.StringUtils;
import com.google.common.base.Splitter;
/**
* Contains utility methods for rendering data to a formatted console output.
* E.g. it provides helper methods for rendering ASCII-based data tables.
*
* @author Gunnar Hillert
* @author Thomas Risberg
* @author Janne Valkealahti
*
*/
public abstract class UiUtils {
public static final String HORIZONTAL_LINE = "-------------------------------------------------------------------------------\n";
public static final int COLUMN_1 = 1;
public static final int COLUMN_2 = 2;
public static final int COLUMN_3 = 3;
public static final int COLUMN_4 = 4;
public static final int COLUMN_5 = 5;
public static final int COLUMN_6 = 6;
/**
* Renders a textual representation of the list of provided Map data
*
* @param columns List of Maps
* @param data the data
* @return The rendered table representation as String
*
*/
public static String renderMapDataAsTable(List