|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.unboundid.util.ColumnFormatter
@NotMutable @ThreadSafety(level=NOT_THREADSAFE) public final class ColumnFormatter
This class provides a utility for formatting output in multiple columns. Each column will have a defined width and alignment. It can alternately generate output as tab-delimited text or comma-separated values (CSV).
| Constructor Summary | |
|---|---|
ColumnFormatter(boolean includeTimestamp,
java.lang.String timestampFormat,
OutputFormat outputFormat,
java.lang.String spacer,
FormattableColumn... columns)
Creates a column formatter that will format the provided columns. |
|
ColumnFormatter(FormattableColumn... columns)
Creates a column formatter that will format the provided columns with the default settings. |
|
| Method Summary | |
|---|---|
java.lang.String |
formatRow(java.lang.Object... columnData)
Formats a row of data. |
FormattableColumn[] |
getColumns()
Retrieves the set of columns for this formatter. |
java.lang.String[] |
getHeaderLines(boolean includeDashes)
Obtains the lines that should comprise the column headers. |
OutputFormat |
getOutputFormat()
Retrieves the output format that will be used. |
java.lang.String |
getSpacer()
Retrieves the spacer that will be used between columns. |
java.lang.String |
getTimestampFormatString()
Retrieves the format string that will be used for generating timestamps. |
boolean |
includeTimestamps()
Indicates whether timestamps will be included in the output. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ColumnFormatter(FormattableColumn... columns)
columns - The columns to be formatted. At least one column must be
provided.
public ColumnFormatter(boolean includeTimestamp,
java.lang.String timestampFormat,
OutputFormat outputFormat,
java.lang.String spacer,
FormattableColumn... columns)
includeTimestamp - Indicates whether to insert a timestamp before
the first column when generating data linestimestampFormat - The format string to use for the timestamp. It
may be null if no timestamp should be
included or the default format should be used.
If a format is provided, then it should be one
that will always generate timestamps with a
constant width.outputFormat - The output format to use.spacer - The spacer to use between columns. It may be
null if the default spacer should be
used. This will only apply for an output format
of COLUMNS.columns - The columns to be formatted. At least one
column must be provided.| Method Detail |
|---|
public boolean includeTimestamps()
true if timestamps should be included, or false
if not.public java.lang.String getTimestampFormatString()
public OutputFormat getOutputFormat()
public java.lang.String getSpacer()
public FormattableColumn[] getColumns()
public java.lang.String[] getHeaderLines(boolean includeDashes)
includeDashes - Indicates whether to include a row of dashes below
the headers if appropriate for the output format.
public java.lang.String formatRow(java.lang.Object... columnData)
columnData - The elements to include in each row of the data.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||