Package com.gengoai.string
Class TableFormatter
- java.lang.Object
-
- com.gengoai.string.TableFormatter
-
- All Implemented Interfaces:
Serializable
public class TableFormatter extends Object implements Serializable
The type Table formatter.- Author:
- David B. Bracewell
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TableFormatter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear.TableFormatter
content(Collection<?> collection)
Content table formatter.TableFormatter
footer(Collection<?> collection)
<T> TableFormatter
header(Collection<? extends T> collection)
Header table formatter.void
print(PrintStream stream)
Print the table to the give PrintStream .void
setMinCellWidth(int cellWidth)
Sets min cell width.void
setNumberFormatter(DecimalFormat decimalFormat)
Sets number formatter.TableFormatter
title(String title)
Title table formatter.Resource
write(Resource resource)
Writes the table to a resource.
-
-
-
Method Detail
-
clear
public void clear()
Clear.
-
content
public TableFormatter content(Collection<?> collection)
Content table formatter.- Parameters:
collection
- the collection- Returns:
- the table formatter
-
footer
public TableFormatter footer(Collection<?> collection)
-
header
public <T> TableFormatter header(Collection<? extends T> collection)
Header table formatter.- Parameters:
collection
- the collection- Returns:
- the table formatter
-
print
public void print(PrintStream stream)
Print the table to the give PrintStream .- Parameters:
stream
- the print stream to write to
-
setMinCellWidth
public void setMinCellWidth(int cellWidth)
Sets min cell width.- Parameters:
cellWidth
- the cell width
-
setNumberFormatter
public void setNumberFormatter(DecimalFormat decimalFormat)
Sets number formatter.- Parameters:
decimalFormat
- the decimal format
-
title
public TableFormatter title(String title)
Title table formatter.- Parameters:
title
- the title- Returns:
- the table formatter
-
write
public Resource write(Resource resource) throws IOException
Writes the table to a resource.- Parameters:
resource
- the resource to write to- Returns:
- the resource written to
- Throws:
IOException
- Something went wrong writing to the resource
-
-