org.jbehave.core.model
Class ExamplesTable

java.lang.Object
  extended by org.jbehave.core.model.ExamplesTable

public class ExamplesTable
extends Object

Represents a tabular structure that holds rows of example data for parameters named via the column headers:

 |header 1|header 2| .... |header n|
 |value 11|value 12| .... |value 1n|
 ...
 |value m1|value m2| .... |value mn|
 

Different header and value column separators can be specified to replace the default separator "|":

 !!header 1!!header 2!! .... !!header n!!
 !value 11!value 12! .... !value 1n!
 ...
 !value m1!value m2| .... !value mn!
 

Rows starting with an ignorable separator are allowed and ignored:

 |header 1|header 2| .... |header n|
 |-- A commented row --|
 |value 11|value 12| .... |value 1n|
 ...
 |-- Another commented row --|
 |value m1|value m2| .... |value mn|
 

Ignorable separator is configurable and defaults to "|--".

By default all column values are trimmed. To avoid trimming the values:

 {trim=false}
 | header 1 | header 2 | .... | header n |
 | value 11 | value 12 | .... | value 1n |
 


Field Summary
static ExamplesTable EMPTY
           
 
Constructor Summary
ExamplesTable(String tableAsString)
           
ExamplesTable(String tableAsString, String headerSeparator, String valueSeparator)
           
ExamplesTable(String tableAsString, String headerSeparator, String valueSeparator, String ignorableSeparator)
           
 
Method Summary
 String asString()
           
protected  Map<String,String> createRowMap()
           
 List<String> getHeaders()
           
 String getHeaderSeparator()
           
 Properties getProperties()
           
 Map<String,String> getRow(int row)
           
 int getRowCount()
           
 List<Map<String,String>> getRows()
           
 String getValueSeparator()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY

public static final ExamplesTable EMPTY
Constructor Detail

ExamplesTable

public ExamplesTable(String tableAsString)

ExamplesTable

public ExamplesTable(String tableAsString,
                     String headerSeparator,
                     String valueSeparator)

ExamplesTable

public ExamplesTable(String tableAsString,
                     String headerSeparator,
                     String valueSeparator,
                     String ignorableSeparator)
Method Detail

createRowMap

protected Map<String,String> createRowMap()

getProperties

public Properties getProperties()

getHeaders

public List<String> getHeaders()

getRow

public Map<String,String> getRow(int row)

getRowCount

public int getRowCount()

getRows

public List<Map<String,String>> getRows()

getHeaderSeparator

public String getHeaderSeparator()

getValueSeparator

public String getValueSeparator()

asString

public String asString()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2003-2010. All Rights Reserved.