public class PrintStyleBuilder extends Object
PrintStyle objects. Example:
PrintStyle printStyle = new PrintStyleBuilder()
.withHeader()
.withRowFormat("%-15s %19s")
.withDurationFormat(DurationFormat.FULL)
.withoutLegends()
.withSimpleLine('-', 36)
.build();
PrintFormat| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_FORMAT |
| Constructor and Description |
|---|
PrintStyleBuilder()
Creates an empty PrintStyle builder.
|
PrintStyleBuilder(PrintStyle baseStyle)
Creates a new PrintStyle builder with the same attributes of the specified base
PrintStyle.
|
| Modifier and Type | Method and Description |
|---|---|
PrintStyle |
build()
Builds the PrintStyle.
|
static String |
generateLine(char character,
int length)
Generates a string using the specified character repeated to a given length.
|
static boolean |
isEmpty(String string)
Returns
true if the specified string is either null or empty. |
PrintStyleBuilder |
withAlternativeLine(char character,
int length)
Defines an alternative line, to be generated using the specified character repeated to
a given length.
|
PrintStyleBuilder |
withAlternativeLine(String string)
Defines an alternative line.
|
PrintStyleBuilder |
withDurationFormat(DurationFormat format)
Defines the
DurationFormat to be applied on all rows containing a time
duration. |
PrintStyleBuilder |
withHeader()
Enables the header row, to be formatted using the same general format for all rows.
|
PrintStyleBuilder |
withHeader(String format)
Enables the header row and defines a specific string format to be applied.
|
PrintStyleBuilder |
withLegends()
Enables printing legends after time durations.
|
PrintStyleBuilder |
withoutHeader()
Explicitly disables the header row.
|
PrintStyleBuilder |
withoutLegends()
Explicitly disables legends after time durations.
|
PrintStyleBuilder |
withoutSectionSummary()
Explicitly disables the section summary row.
|
PrintStyleBuilder |
withRowFormat(String format)
Defines a string format to be applied for all rows.
|
PrintStyleBuilder |
withSectionHeaderFormat(String format)
Defines a string format to the applied for the section headers.
|
PrintStyleBuilder |
withSectionSummary(String format)
Enables the section summary row and defines the string format to be applied.
|
PrintStyleBuilder |
withSimpleLine(char character,
int length)
Defines a simple line, to be generated using the specified character repeated to a
given length.
|
PrintStyleBuilder |
withSimpleLine(String string)
Defines a simple line.
|
public static final String DEFAULT_FORMAT
public PrintStyleBuilder()
public PrintStyleBuilder(PrintStyle baseStyle)
baseStyle - the base PrintStyle whose attributes are to be copiedNullPointerException - if the specified PrintStyle is nullpublic PrintStyleBuilder withRowFormat(String format)
format - the string format to be appliedpublic PrintStyleBuilder withHeader()
To specify a different format for the header row, use withHeader(String).
public PrintStyleBuilder withHeader(String format)
To enable header without specifying a format, use the zero-argument option
withHeader().
format - the string format to be applied for the header rowpublic PrintStyleBuilder withoutHeader()
public PrintStyleBuilder withSectionHeaderFormat(String format)
format - the string format to be applied for each section header rowpublic PrintStyleBuilder withoutSectionSummary()
public PrintStyleBuilder withSectionSummary(String format)
format - the string format to be applied for the section summary rowpublic PrintStyleBuilder withSimpleLine(char character, int length)
character - a character to compose the stringlength - number of times to repeat the character; must be > 0public PrintStyleBuilder withSimpleLine(String string)
string - the string to be used as the simple linepublic PrintStyleBuilder withAlternativeLine(char character, int length)
character - a character to compose the stringlength - number of times to repeat the character; must be > 0public PrintStyleBuilder withAlternativeLine(String string)
string - the string to be used as the alternative linepublic PrintStyleBuilder withDurationFormat(DurationFormat format)
DurationFormat to be applied on all rows containing a time
duration.format - the DurationFormat to be appliedpublic PrintStyleBuilder withLegends()
public PrintStyleBuilder withoutLegends()
public PrintStyle build()
PrintStyle; not nullpublic static boolean isEmpty(String string)
true if the specified string is either null or empty.string - the string to be checkedpublic static String generateLine(char character, int length)
character - a character to compose the stringlength - number of times to repeat the character; must be > 0Copyright © 2021. All rights reserved.