public DataContainer<E> next(DataContainer<E> container) { DataContainer<String[]> wrapper = source.next(getSourceContainer()); if (wrapper == null) return null; String[] cells = wrapper.getData(); E result = BeanUtil.newInstance(beanClass); for (int i = 0; i < columnDescriptors.length; i++) BeanUtil.setPropertyValue(result, columnDescriptors[i].getName(), cells[i], true, true); return container.setData(result); }
public ProductWrapper<E> generate(ProductWrapper<E> wrapper) { try { assertInitialized(); if (iterator == null) iterator = source.iterator(); // iterator initialized lazily to reflect context state at invocation DataContainer<E> tmp = iterator.next(container.get()); if (tmp == null) { IOUtil.close(iterator); return null; } return wrapper.wrap(tmp.getData()); } catch (Exception e) { throw new IllegalGeneratorStateException("Generation failed: ", e); } }