}
@Override
public DataModelReflection next() throws IOException {
while (nextRowNumber <= sheet.getLastRowNum()) {
Row row = sheet.getRow(nextRowNumber++);
if (row == null) {
LOG.warn(MessageFormat.format(
"有効な値を含まない行はスキップします: (row={1}, id={0})",
id,
nextRowNumber));
continue;
}
boolean sawFilled = false;
ExcelDataDriver driver = new ExcelDataDriver(definition, id);
for (Map.Entry<PropertyName, Integer> entry : names.entrySet()) {
Cell cell = row.getCell(entry.getValue(), Row.CREATE_NULL_AS_BLANK);
int type = cell.getCellType();
if (type == Cell.CELL_TYPE_FORMULA) {
evaluateInCell(cell);
type = cell.getCellType();
}
if (type == Cell.CELL_TYPE_ERROR) {
throw new IOException(MessageFormat.format(
"セルの値にエラーがあります: (pos=({1}, {2}), id={0})",
id,
row.getRowNum() + 1,
cell.getColumnIndex() + 1));
}
sawFilled |= (type != Cell.CELL_TYPE_BLANK);
driver.process(entry.getKey(), cell);
}
if (sawFilled) {
return driver.getReflection();
} else {
LOG.warn(MessageFormat.format(
"有効な値を含まない行はスキップします: (row={1}, id={0})",
id,
row.getRowNum() + 1));
}
}
return null;
}