public class DataTable extends Object
Constructor and Description |
---|
DataTable(List<gherkin.formatter.model.DataTableRow> gherkinRows,
cucumber.runtime.table.TableConverter tableConverter)
Creates a new DataTable.
|
Modifier and Type | Method and Description |
---|---|
<T> List<T> |
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) |
<T> T |
convert(Type type) |
static DataTable |
create(List<?> raw) |
static DataTable |
create(List<?> raw,
Locale locale,
String... columnNames) |
static DataTable |
create(List<?> raw,
String format,
String... columnNames) |
void |
diff(DataTable other)
Diffs this table with
other . |
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() |
boolean |
equals(Object o) |
List<String> |
flatten() |
List<gherkin.formatter.model.DataTableRow> |
getGherkinRows()
Internal method.
|
cucumber.runtime.table.TableConverter |
getTableConverter() |
int |
hashCode() |
List<List<String>> |
raw()
Converts the table to a 2D array.
|
List<String> |
topCells() |
String |
toString() |
DataTable |
toTable(List<?> raw,
String... columnNames)
|
public DataTable(List<gherkin.formatter.model.DataTableRow> gherkinRows, cucumber.runtime.table.TableConverter tableConverter)
gherkinRows
- the underlying rows.tableConverter
- how to convert the rows.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 DataTable toTable(List<?> raw, String... columnNames)
raw
- a list of objectscolumnNames
- optional explicit header columnspublic 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 void diff(DataTable other) throws cucumber.runtime.table.TableDiffException
other
.other
- the other table to diff with.cucumber.runtime.table.TableDiffException
- if the tables are different.public List<gherkin.formatter.model.DataTableRow> getGherkinRows()
public List<cucumber.runtime.table.DiffableRow> diffableRows()
public cucumber.runtime.table.TableConverter getTableConverter()
Copyright © 2013. All Rights Reserved.