String formatCell(Object value, int column) {
        int width = columnWidths.get(column);
        TextTableAlignment align = columnAlignments.get(column);
        Function<Object, String> formatter = columnFormatters.get(column);
        String content = formatter.apply(value);

        if (content.length() > width) {
            // truncate
            content = StringUtils.abbreviate(content, width);
        } else if (content.length() < width) {
            // add padding
            switch (align) {
                case LEFT:
                    content = StringUtils.rightPad(content, width);
                    break;
                case RIGHT:
                    content = StringUtils.leftPad(content, width);
                    break;
                case CENTER:
                    content = StringUtils.center(content, width);
                    break;
            }
        }

        return content;
    }
@author Nico Bergemann <barracuda415 at yahoo.de>
disunity-cli/src/main/java/info/ata4/disunity/cli/util/TextTableFormat.java