Package com.unboundid.util
Class FormattableColumn
java.lang.Object
com.unboundid.util.FormattableColumn
- All Implemented Interfaces:
Serializable
@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class FormattableColumn
extends Object
implements Serializable
This class provides a data structure with information about a column to use
with the
ColumnFormatter.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringA system property that can be used to specify what character should be used when escaping quotation marks in the output. -
Constructor Summary
ConstructorsConstructorDescriptionFormattableColumn(int width, HorizontalAlignment alignment, String... labelLines) Creates a new formattable column with the provided information. -
Method Summary
Modifier and TypeMethodDescriptionvoidformat(StringBuilder buffer, String text, OutputFormat format) Appends a formatted representation of the provided text to the given buffer.Retrieves the alignment for this column.String[]Retrieves the lines to use as the label for this column.Retrieves a single-line representation of the label.intgetWidth()Retrieves the width for this column.static voidsetCSVQuoteEscapeCharacter(char c) Specifies the character that should be used to escape the double quote character in CSV-formatted values.toString()Retrieves a string representation of this formattable column.voidtoString(StringBuilder buffer) Appends a string representation of this formattable column to the provided buffer.
-
Field Details
-
CSV_QUOTE_ESCAPE_CHARACTER_PROPERTY
A system property that can be used to specify what character should be used when escaping quotation marks in the output. If set, the value of the property should be a single character, and it is recommended to be either the double quote character or the backslash character.
-
-
Constructor Details
-
FormattableColumn
public FormattableColumn(int width, @NotNull HorizontalAlignment alignment, @NotNull String... labelLines) Creates a new formattable column with the provided information.- Parameters:
width- The width to use for this column. It must be greater than or equal to 1.alignment- The alignment to use for this column. It must not benull.labelLines- The lines to use as the label for this column. It must not benull.
-
-
Method Details
-
getWidth
Retrieves the width for this column.- Returns:
- The width for this column.
-
getAlignment
Retrieves the alignment for this column.- Returns:
- The alignment for this column.
-
getLabelLines
Retrieves the lines to use as the label for this column.- Returns:
- The lines to use as the label for this column.
-
getSingleLabelLine
Retrieves a single-line representation of the label. If there are multiple header lines, then they will be concatenated and separated by a space.- Returns:
- A single-line representation of the label.
-
format
public void format(@NotNull StringBuilder buffer, @NotNull String text, @NotNull OutputFormat format) Appends a formatted representation of the provided text to the given buffer.- Parameters:
buffer- The buffer to which the text should be appended. It must not benull.text- The text to append to the buffer. It must not benull.format- The format to use for the text. It must not benull.
-
setCSVQuoteEscapeCharacter
Specifies the character that should be used to escape the double quote character in CSV-formatted values. RFC 4180 states that it should be a double quote character (that is, a single double quote should be formatted as '""'), and that is now the default behavior, but the LDAP SDK formerly used a backslash as an escape character (like '\"'), and this method can be used to restore that behavior if desired. Alternatively, this can be accomplished without any change to the application source code by launching the JVM with thecom.unboundid.util.FormattableColumn.csvQuoteEscapeCharactersystem property set to a value that contains only the backslash character.- Parameters:
c- The character to use to escape the double quote character in CSV-formatted values. This is only recommended to be the double quote character or the backslash character.
-
toString
Retrieves a string representation of this formattable column. -
toString
Appends a string representation of this formattable column to the provided buffer.- Parameters:
buffer- The buffer to which the string representation should be appended.
-