|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cucumber.table.DataTable
public class DataTable
A DataTable represents the data in a table following a step in Gherkin. 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,
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. |
|
|
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<String> |
flatten()
|
|
List<gherkin.formatter.model.DataTableRow> |
getGherkinRows()
Internal method. |
|
List<List<String>> |
raw()
Converts the table to a 2D array. |
|
String |
toString()
|
|
DataTable |
toTable(List<?> raw,
String... columnNames)
Creates another table using the same Locale and DateFormat 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, 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 DataTable toTable(List<?> raw, String... columnNames)
Locale
and DateFormat
that was used to create this table.
raw
- a list of objectscolumnNames
- optional explicit header columns
public void diff(List<?> other) throws TableDiffException
other
, which can be a List<List<String>>
or a
List<YourType>
.
other
- the other table to diff with.
TableDiffException
- if the tables are different.public List<gherkin.formatter.model.DataTableRow> getGherkinRows()
public String toString()
toString
in class Object
public List<String> flatten()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |