TableBuilder
TableBuilderImpl
public interface TablePrinter
TableBuilder
, the TablePrinter
just
provides the methods required to print a table. This is most useful when you
want to create a TablePrinter
composite (which encapsulates many
TablePrinter
instances) which only requires the printing methods as
the builder methods would make no sense: Think of a TablePrinter
which is used for logging text with a log priority. For each log priority
there is a dedicated TablePrinter
instance configured slightly
different, e.g using different text colors for the printed row depending on
the log priority. Those "internal" TablePrinter
instances would be
pre-configured so that a TableBuilder
composite would actually
overload the composite with Builder-Pattern functionality which must not be
applied to the internal TablePrinter
instances. Actually the internal
TablePrinter
instances would be part (implementation secret) of a
TableBuilder
instance as them are configured each individually using
the Builder-Pattern.Modifier and Type | Method | Description |
---|---|---|
TableStatus |
getTableStatus() |
Retrieves the
TablePrinter (TableBuilder ) status. |
void |
printHeader(String... aColumns) |
Prints the table's header to the
PrintStream configured for this
PrintWriter with the content of the provided columns. |
default void |
printHeader(List<String> aColumns) |
Prints the table's header to the
PrintStream configured for this
PrintWriter with the content of the provided columns. |
void |
printHeaderBegin() |
Prints out a header begin to the
PrintStream configured for this
PrintWriter , for convenience reasons, this is being encapsulated
by the printHeader(String...) method. |
default void |
printHeaderComplete() |
For more semantic clearness this method prints an end-of-header /
begin-of-row line, though is equivalent to the method
printHeaderBegin() . |
void |
printHeaderContinue(String... aColumns) |
Continues to print out a begun header to the
PrintStream
configured for this PrintWriter , for convenience reasons, this is
being encapsulated by the printHeader(String...) method. |
default void |
printHeaderContinue(List<String> aColumns) |
Continues to print out a begun header to the
PrintStream
configured for this PrintWriter , for convenience reasons, this is
being encapsulated by the printHeader(String...) method. |
void |
printHeaderEnd() |
Prints out a header end to the
PrintStream configured for this
PrintWriter , for convenience reasons, this is being encapsulated
by the printHeader(String...) method. |
void |
printHeaderEnd(TableBuilder aTablePrinter) |
Ends the headers of the provided
TableBuilder for this table
printer to continue to the PrintStream configured for this
PrintWriter ; different header widths and column widths are taken
care of, so it is a pleasure to mix different TableBuilder s,
especially when empty columns may result in better using another column
layout making better use of the available width. |
void |
printRow(String... aColumns) |
Prints the table's (next) row to the
PrintStream configured for
this PrintWriter with the content of the provided columns. |
default void |
printRow(List<String> aColumns) |
Prints the table's (next) row to the
PrintStream configured for
this PrintWriter with the content of the provided columns. |
void |
printRowBegin() |
Prints out a row begin to the
PrintStream configured for this
PrintWriter , for convenience reasons, this is being encapsulated
by the printRow(String...) method. |
void |
printRowContinue(String... aColumns) |
Continues a print out begun row to the
PrintStream configured for
this PrintWriter , for convenience reasons, this is being
encapsulated by the printRow(String...) method. |
default void |
printRowContinue(List<String> aColumns) |
Continues a print out begun row to the
PrintStream configured for
this PrintWriter , for convenience reasons, this is being
encapsulated by the printRow(String...) method. |
void |
printRowEnd(TableBuilder aTablePrinter) |
Ends the rows of the provided
TableBuilder for this table printer
to continue to the PrintStream configured for this
PrintWriter ; different row widths and column widths are taken
care of, so it is a pleasure to mix different TableBuilder s,
especially when empty columns may result in better using another column
layout making better use of the available width. |
void |
printTail() |
Finishes off the table by printing its closing to the
PrintStream
configured for this PrintWriter . |
TablePrinter |
setTableStatus(TableStatus aTableStatus) |
Set the
TablePrinter (TableBuilder ) status. |
String |
toHeader(String... aColumns) |
Prints the table's header with the content of the provided columns.
|
default String |
toHeader(List<String> aColumns) |
Prints the table's header with the content of the provided columns.
|
String |
toHeaderBegin() |
Begins a header, for convenience reasons, this is being encapsulated by
the
toHeader(String...) method. |
default String |
toHeaderComplete() |
For more semantic clearness this method returns an end-of-header /
begin-of-row line, though is equivalent to the method
toHeaderBegin() . |
String |
toHeaderContinue(String... aColumns) |
Continues a begun header, for convenience reasons, this is being
encapsulated by the
toHeader(String...) method. |
default String |
toHeaderContinue(List<String> aColumns) |
Continues a begun header, for convenience reasons, this is being
encapsulated by the
toHeader(String...) method. |
String |
toHeaderEnd() |
Ends a header, for convenience reasons, this is being encapsulated by the
toHeader(String...) method. |
String |
toHeaderEnd(TableBuilder aTablePrinter) |
Ends the headers of the provided
TableBuilder for this table
printer to continue; different header widths and column widths are taken
care of, so it is a pleasure to mix different TableBuilder s,
especially when empty columns may result in better using another column
layout making better use of the available width. |
String |
toRow(String... aColumns) |
Prints the table's (next) row with the content of the provided columns.
|
default String |
toRow(List<String> aColumns) |
Prints the table's (next) row with the content of the provided columns.
|
String |
toRowBegin() |
Begins a row, for convenience reasons, this is being encapsulated by the
toRow(String...) method. |
String |
toRowContinue(String... aColumns) |
Continues a begun row, for convenience reasons, this is being
encapsulated by the
toRow(String...) method. |
default String |
toRowContinue(List<String> aColumns) |
Continues a begun row, for convenience reasons, this is being
encapsulated by the
toRow(String...) method. |
String |
toRowEnd(TableBuilder aTablePrinter) |
Ends the rows of the provided
TableBuilder for this table printer
to continue; different row widths and column widths are taken care of, so
it is a pleasure to mix different TableBuilder s, especially when
empty columns may result in better using another column layout making
better use of the available width. |
String |
toTail() |
Finishes off the table by closing it.
|
String toHeaderBegin()
toHeader(String...)
method. Use this method in case you need
more control on the header construction than toHeader(String...)
can provide you.String
including the line breaks.default String toHeaderComplete()
toHeaderBegin()
.String
including the line
breaks.String toHeaderContinue(String... aColumns)
toHeader(String...)
method. Use this method
in case you need more control on the header construction than
toHeader(String...)
can provide you.aColumns
- the columnsString
including the line
breaks.default String toHeaderContinue(List<String> aColumns)
toHeader(String...)
method. Use this method
in case you need more control on the header construction than
toHeader(String...)
can provide you.aColumns
- the columnsString
including the line
breaks.String toHeaderEnd(TableBuilder aTablePrinter)
TableBuilder
for this table
printer to continue; different header widths and column widths are taken
care of, so it is a pleasure to mix different TableBuilder
s,
especially when empty columns may result in better using another column
layout making better use of the available width.aTablePrinter
- The TableBuilder
to which to append this
TableBuilder
's headers.TableBuilder
's layout with this (bottom)
TableBuilder
's layout.String toHeaderEnd()
toHeader(String...)
method. Use this method in case you need
more control on the header construction than toHeader(String...)
can provide you.String
including the line breaks.String toRowBegin()
toRow(String...)
method. Use this method in case you need more
control on the row construction than toRow(String...)
can
provide you.String
including the line breaks.String toRowContinue(String... aColumns)
toRow(String...)
method. Use this method in
case you need more control on the header construction than
toRow(String...)
can provide you.aColumns
- the columnsString
including the line breaks.default String toRowContinue(List<String> aColumns)
toRow(String...)
method. Use this method in
case you need more control on the header construction than
toRow(String...)
can provide you.aColumns
- the columnsString
including the line breaks.String toRowEnd(TableBuilder aTablePrinter)
TableBuilder
for this table printer
to continue; different row widths and column widths are taken care of, so
it is a pleasure to mix different TableBuilder
s, especially when
empty columns may result in better using another column layout making
better use of the available width.aTablePrinter
- The TableBuilder
to which to append this
TableBuilder
's rows.TableBuilder
's
layout with this (bottom) TableBuilder
's layout.String toHeader(String... aColumns)
aColumns
- The columns to be used in the table's header.String
including line breaks as it most
probably will consist of more than one line.default String toHeader(List<String> aColumns)
aColumns
- The columns to be used in the table's header.String
including line breaks as it most
probably will consist of more than one line.String toRow(String... aColumns)
aColumns
- The columns to be used in the (next) table's row.String
including line breaks as it most probably
will consist of more than one line.default String toRow(List<String> aColumns)
aColumns
- The columns to be used in the (next) table's row.String
including line breaks as it most probably
will consist of more than one line.String toTail()
void printHeaderBegin()
PrintStream
configured for this
PrintWriter
, for convenience reasons, this is being encapsulated
by the printHeader(String...)
method. Use this method in case
you need more control on the header construction than
printHeader(String...)
can provide you.default void printHeaderComplete()
printHeaderBegin()
.void printHeaderContinue(String... aColumns)
PrintStream
configured for this PrintWriter
, for convenience reasons, this is
being encapsulated by the printHeader(String...)
method. Use
this method in case you need more control on the header construction than
printHeader(String...)
can provide you.aColumns
- the columnsdefault void printHeaderContinue(List<String> aColumns)
PrintStream
configured for this PrintWriter
, for convenience reasons, this is
being encapsulated by the printHeader(String...)
method. Use
this method in case you need more control on the header construction than
printHeader(String...)
can provide you.aColumns
- the columnsvoid printHeaderEnd(TableBuilder aTablePrinter)
TableBuilder
for this table
printer to continue to the PrintStream
configured for this
PrintWriter
; different header widths and column widths are taken
care of, so it is a pleasure to mix different TableBuilder
s,
especially when empty columns may result in better using another column
layout making better use of the available width.aTablePrinter
- The TableBuilder
to which to append this
TableBuilder
's headers.void printHeaderEnd()
PrintStream
configured for this
PrintWriter
, for convenience reasons, this is being encapsulated
by the printHeader(String...)
method. Use this method in case
you need more control on the header construction than
printHeader(String...)
can provide you.void printRowBegin()
PrintStream
configured for this
PrintWriter
, for convenience reasons, this is being encapsulated
by the printRow(String...)
method. Use this method in case you
need more control on the row construction than
printRow(String...)
can provide you.void printRowContinue(String... aColumns)
PrintStream
configured for
this PrintWriter
, for convenience reasons, this is being
encapsulated by the printRow(String...)
method. Use this method
in case you need more control on the header construction than
printRow(String...)
can provide you.aColumns
- the columnsdefault void printRowContinue(List<String> aColumns)
PrintStream
configured for
this PrintWriter
, for convenience reasons, this is being
encapsulated by the printRow(String...)
method. Use this method
in case you need more control on the header construction than
printRow(String...)
can provide you.aColumns
- the columnsvoid printRowEnd(TableBuilder aTablePrinter)
TableBuilder
for this table printer
to continue to the PrintStream
configured for this
PrintWriter
; different row widths and column widths are taken
care of, so it is a pleasure to mix different TableBuilder
s,
especially when empty columns may result in better using another column
layout making better use of the available width.aTablePrinter
- The TableBuilder
to which to append this
TableBuilder
's rows.void printHeader(String... aColumns)
PrintStream
configured for this
PrintWriter
with the content of the provided columns.aColumns
- The columns to be used in the table's header.default void printHeader(List<String> aColumns)
PrintStream
configured for this
PrintWriter
with the content of the provided columns.aColumns
- The columns to be used in the table's header.void printRow(String... aColumns)
PrintStream
configured for
this PrintWriter
with the content of the provided columns. Call
this method for each row to print out.aColumns
- The columns to be used in the (next) table's row.default void printRow(List<String> aColumns)
PrintStream
configured for
this PrintWriter
with the content of the provided columns. Call
this method for each row to print out.aColumns
- The columns to be used in the (next) table's row.void printTail()
PrintStream
configured for this PrintWriter
.TableStatus getTableStatus()
TablePrinter
(TableBuilder
) status.
The TableStatus
is required by a TablePrinter
(
TableBuilder
) to determine whether to do additional table
decoration for a print operation or to fail that operation as of an
illegal state exception. As far as possible an illegal state exception is
to be tried to be prevented by decorating the table automatically by an
operation as of the current TableStatus
.TableStatus
.TablePrinter setTableStatus(TableStatus aTableStatus)
TablePrinter
(TableBuilder
) status.
The TableStatus
is required by a TablePrinter
(
TableBuilder
) to determine whether to do additional table
decoration for a print operation or to fail that operation as of an
illegal state exception. As far as possible an illegal state exception is
to be tried to be prevented by decorating the table automatically by an
operation as of the current TableStatus
.
Setting the status manually, you can use differently configured
TablePrinter
interfaces to print their lines according to the
status of a previous TablePrinter
.aTableStatus
- The table's current TableStatus
to be set.Copyright © 2018. All rights reserved.