|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcucumber.api.DataTable
public class DataTable
Represents the data from a Gherkin DataTable. Cucumber will convert the table in Gherkin to a DataTable instance and pass it to a step definition.
Constructor Summary | |
---|---|
DataTable(List<gherkin.formatter.model.DataTableRow> gherkinRows,
cucumber.runtime.table.TableConverter tableConverter)
Creates a new DataTable. |
Method Summary | ||
---|---|---|
|
asList(Type type)
Converts the table to a List of objects. |
|
List<Map<String,String>> |
asMaps()
Converts the table to a List of Map. |
|
List<List<String>> |
cells(int firstRow)
|
|
|
convert(Type type)
|
|
static DataTable |
create(List<?> raw)
|
|
static DataTable |
create(List<?> raw,
Locale locale,
String... columnNames)
|
|
static DataTable |
create(List<?> raw,
String dateFormat,
String... columnNames)
|
|
void |
diff(List<?> other)
Diffs this table with other , which can be a List<List<String>> or a
List<YourType> . |
|
List<cucumber.runtime.table.DiffableRow> |
diffableRows()
|
|
List<String> |
flatten()
|
|
List<gherkin.formatter.model.DataTableRow> |
getGherkinRows()
Internal method. |
|
cucumber.runtime.table.TableConverter |
getTableConverter()
|
|
List<List<String>> |
raw()
Converts the table to a 2D array. |
|
List<String> |
topCells()
|
|
String |
toString()
|
|
DataTable |
toTable(List<?> raw,
String... columnNames)
Creates another table using the same Locale and Format that was used to create this table. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DataTable(List<gherkin.formatter.model.DataTableRow> gherkinRows, cucumber.runtime.table.TableConverter tableConverter)
gherkinRows
- the underlying rows.tableConverter
- how to convert the rows.Method Detail |
---|
public static DataTable create(List<?> raw)
public static DataTable create(List<?> raw, String dateFormat, String... columnNames)
public static DataTable create(List<?> raw, Locale locale, String... columnNames)
public List<List<String>> raw()
public <T> T convert(Type type)
public List<Map<String,String>> asMaps()
public <T> List<T> asList(Type type)
T
- the type of each objecttype
- the type of the result (should be a List
generic type)
public List<String> topCells()
public List<List<String>> cells(int firstRow)
public DataTable toTable(List<?> raw, String... columnNames)
Locale
and Format
that was used to create this table.
raw
- a list of objectscolumnNames
- optional explicit header columns
public void diff(List<?> other) throws cucumber.runtime.table.TableDiffException
other
, which can be a List<List<String>>
or a
List<YourType>
.
other
- the other table to diff with.
cucumber.runtime.table.TableDiffException
- if the tables are different.public List<gherkin.formatter.model.DataTableRow> getGherkinRows()
public String toString()
toString
in class Object
public List<cucumber.runtime.table.DiffableRow> diffableRows()
public cucumber.runtime.table.TableConverter getTableConverter()
public List<String> flatten()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |