TableBuilder
  public
  
  
  
  class
  TableBuilder
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | com.android.tradefed.util.TableBuilder | 
Helper class to display a matrix of String elements in a table.
Summary
| Public constructors | |
|---|---|
| 
      TableBuilder(int numColumns)
      Constructs a TableBuilder with specific number of columns. | |
| Public methods | |
|---|---|
| 
        
        
        
        
        
        TableBuilder | 
      addBlankLineSeparator()
      Adds a row separator like: | | (blank space between two pipes) | 
| 
        
        
        
        
        
        TableBuilder | 
      addDoubleLineSeparator()
      Adds a row separator like: +=============================================+ | 
| 
        
        
        
        
        
        TableBuilder | 
      addLine(String[] line)
      Adds a line. | 
| 
        
        
        
        
        
        TableBuilder | 
      addLine(String line)
      Adds a single long line. | 
| 
        
        
        
        
        
        TableBuilder | 
      addSeparator(char end, char pipe)
      Adds a custom row separator. | 
| 
        
        
        
        
        
        TableBuilder | 
      addSingleLineSeparator()
      Adds a row separator like: +---------------------------------------------+ | 
| 
        
        
        
        
        
        TableBuilder | 
      addTitle(String title)
      Adds a title to this table. | 
| 
        
        
        
        
        
        String | 
      build()
      Builds the table and return as a string. | 
| 
        
        
        
        
        
        TableBuilder | 
      setOffset(int offset)
      Sets the number of white space on the left of the whole table | 
| 
        
        
        
        
        
        TableBuilder | 
      setPadding(int padding)
      Sets the number of white space before and after each column element | 
Public constructors
TableBuilder
public TableBuilder (int numColumns)
Constructs a TableBuilder with specific number of columns.
| Parameters | |
|---|---|
| numColumns | int: number of columns in this table. | 
Public methods
addBlankLineSeparator
public TableBuilder addBlankLineSeparator ()
Adds a row separator like: | | (blank space between two pipes)
| Returns | |
|---|---|
| TableBuilder | this | 
addDoubleLineSeparator
public TableBuilder addDoubleLineSeparator ()
Adds a row separator like: +=============================================+
| Returns | |
|---|---|
| TableBuilder | this | 
addLine
public TableBuilder addLine (String[] line)
Adds a line. The number of columns in line must equal numColumns provided in the constructor.
| Parameters | |
|---|---|
| line | String: the line. | 
| Returns | |
|---|---|
| TableBuilder | this | 
| Throws | |
|---|---|
| IllegalArgumentException | when the number of columns in line does not agree with numColumns provided in the constructor. | 
addLine
public TableBuilder addLine (String line)
Adds a single long line. TableBuilder will wrap it if it is too long. See example above.
| Parameters | |
|---|---|
| line | String: the line. | 
| Returns | |
|---|---|
| TableBuilder | this | 
addSeparator
public TableBuilder addSeparator (char end, char pipe)
Adds a custom row separator.
| Parameters | |
|---|---|
| end | char: the two end character. | 
| pipe | char: the character connecting two ends | 
| Returns | |
|---|---|
| TableBuilder | this | 
addSingleLineSeparator
public TableBuilder addSingleLineSeparator ()
Adds a row separator like: +---------------------------------------------+
| Returns | |
|---|---|
| TableBuilder | this | 
addTitle
public TableBuilder addTitle (String title)
Adds a title to this table. Sample: +======================TITLE=======================+
| Parameters | |
|---|---|
| title | String: title | 
| Returns | |
|---|---|
| TableBuilder | this | 
build
public String build ()
Builds the table and return as a string.
| Returns | |
|---|---|
| String | the table in string format. | 
setOffset
public TableBuilder setOffset (int offset)
Sets the number of white space on the left of the whole table
| Parameters | |
|---|---|
| offset | int: the number of white space | 
| Returns | |
|---|---|
| TableBuilder | this | 
setPadding
public TableBuilder setPadding (int padding)
Sets the number of white space before and after each column element
| Parameters | |
|---|---|
| padding | int: the number of white space | 
| Returns | |
|---|---|
| TableBuilder | this | 
