io.cucumber.java8.Java8DataTableRowDefinition Maven / Gradle / Ivy
package io.cucumber.java8;
import io.cucumber.core.backend.DataTableTypeDefinition;
import io.cucumber.datatable.DataTableType;
import java.util.List;
import static net.jodah.typetools.TypeResolver.resolveRawArguments;
final class Java8DataTableRowDefinition extends AbstractDatatableElementTransformerDefinition implements DataTableTypeDefinition {
private final DataTableType dataTableType;
Java8DataTableRowDefinition(String[] emptyPatterns, DataTableRowDefinitionBody> body) {
super(body, new Exception().getStackTrace()[3], emptyPatterns);
Class> returnType = resolveRawArguments(DataTableRowDefinitionBody.class, body.getClass())[0];
this.dataTableType = new DataTableType(
returnType,
(List row) -> execute(replaceEmptyPatternsWithEmptyString(row))
);
}
@Override
public DataTableType dataTableType() {
return dataTableType;
}
private Object execute(List row) {
return Invoker.invoke(this, body, method, row);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy