com.neeve.util
Class UtlTableFormatter

java.lang.Object
  extended by com.neeve.util.UtlTableFormatter

public class UtlTableFormatter
extends Object

Utility class for formating tabular data.

This class IS NOT intended to be used by end users.


Nested Class Summary
static class UtlTableFormatter.Format
          Enumerates the possible table format output.
static class UtlTableFormatter.Table
          The table model.
 
Constructor Summary
UtlTableFormatter(boolean isMultiLine)
           
 
Method Summary
 int calculateDesiredFieldLength(String columnHeader, Object value)
           
 int calculateFieldLength(String columnHeader, Class<?> columnType)
           
static UtlTableFormatter.Table createTable(String... columnHeaders)
           
 Object formatColumn(String columnHeader, Class<?> columnType, Object result, int width, UtlTableFormatter.Format format)
           
 Object formatColumn(String columnHeader, Class<?> columnType, Object result, UtlTableFormatter.Format format)
           
 String formatForSingleLineColumn(String str, int columnWidth)
           
 String getColumnFormat(String columnHeader, Class<?> columnType, int length)
           
 boolean isTimestampColumn(String columnHeader, Class<?> columnType)
          Tests if the given column should be treated as a Date column.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UtlTableFormatter

public UtlTableFormatter(boolean isMultiLine)
Method Detail

formatColumn

public final Object formatColumn(String columnHeader,
                                 Class<?> columnType,
                                 Object result,
                                 UtlTableFormatter.Format format)

formatColumn

public final Object formatColumn(String columnHeader,
                                 Class<?> columnType,
                                 Object result,
                                 int width,
                                 UtlTableFormatter.Format format)

getColumnFormat

public final String getColumnFormat(String columnHeader,
                                    Class<?> columnType,
                                    int length)

calculateFieldLength

public int calculateFieldLength(String columnHeader,
                                Class<?> columnType)

calculateDesiredFieldLength

public int calculateDesiredFieldLength(String columnHeader,
                                       Object value)

isTimestampColumn

public final boolean isTimestampColumn(String columnHeader,
                                       Class<?> columnType)
Tests if the given column should be treated as a Date column.

Parameters:
columnHeader - the header name for the column
Returns:
True if the field should be interpretted as a timestamp.

formatForSingleLineColumn

public final String formatForSingleLineColumn(String str,
                                              int columnWidth)

createTable

public static final UtlTableFormatter.Table createTable(String... columnHeaders)


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.