Package com.unboundid.util
Class FormattableColumn
- java.lang.Object
-
- com.unboundid.util.FormattableColumn
-
- All Implemented Interfaces:
java.io.Serializable
@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class FormattableColumn extends java.lang.Object implements java.io.Serializable
This class provides a data structure with information about a column to use with theColumnFormatter
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FormattableColumn(int width, HorizontalAlignment alignment, java.lang.String... labelLines)
Creates a new formattable column with the provided information.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
format(java.lang.StringBuilder buffer, java.lang.String text, OutputFormat format)
Appends a formatted representation of the provided text to the given buffer.HorizontalAlignment
getAlignment()
Retrieves the alignment for this column.java.lang.String[]
getLabelLines()
Retrieves the lines to use as the label for this column.java.lang.String
getSingleLabelLine()
Retrieves a single-line representation of the label.int
getWidth()
Retrieves the width for this column.java.lang.String
toString()
Retrieves a string representation of this formattable column.void
toString(java.lang.StringBuilder buffer)
Appends a string representation of this formattable column to the provided buffer.
-
-
-
Constructor Detail
-
FormattableColumn
public FormattableColumn(int width, HorizontalAlignment alignment, java.lang.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 Detail
-
getWidth
public int getWidth()
Retrieves the width for this column.- Returns:
- The width for this column.
-
getAlignment
public HorizontalAlignment getAlignment()
Retrieves the alignment for this column.- Returns:
- The alignment for this column.
-
getLabelLines
public java.lang.String[] getLabelLines()
Retrieves the lines to use as the label for this column.- Returns:
- The lines to use as the label for this column.
-
getSingleLabelLine
public java.lang.String 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(java.lang.StringBuilder buffer, java.lang.String text, 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
.
-
toString
public java.lang.String toString()
Retrieves a string representation of this formattable column.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of this formattable column.
-
toString
public void toString(java.lang.StringBuilder buffer)
Appends a string representation of this formattable column to the provided buffer.- Parameters:
buffer
- The buffer to which the string representation should be appended.
-
-