/** * Stores objects into the given sink. * @param <T> the data type * @param objects the source data * @param dataType the data type * @param factory the target sink factory * @since 0.10.3 */ public <T> void dump(Class<T> dataType, Iterable<? extends T> objects, DataModelSinkFactory factory) { Objects.requireNonNull(objects); Objects.requireNonNull(factory); DataModelDefinition<T> definition = toDataModelDefinition(dataType); try (DataModelSink sink = factory.createSink(definition, getTestContext())) { for (T record : objects) { DataModelReflection ref = definition.toReflection(record); sink.put(ref); } } catch (IOException e) { throw new IllegalStateException(MessageFormat.format( "error occurred while saving data: {1} ({0})", dataType.getName(), factory), e); } }
DataModelSink sink = resultDataSink.createSink(definition, context);) { while (true) { DataModelReflection next = source.next();