use of com.revolsys.record.FieldValueInvalidException in project com.revolsys.open by revolsys.
the class MapReaderRecordReader method next.
@Override
public Record next() {
if (hasNext()) {
final MapEx source = this.mapIterator.next();
final Record target = new ArrayRecord(this.recordDefinition);
for (final FieldDefinition field : this.recordDefinition.getFields()) {
final String name = field.getName();
final Object value = source.get(name);
if (value != null) {
final DataType dataType = this.recordDefinition.getFieldType(name);
final Object convertedValue;
try {
convertedValue = dataType.toObject(value);
} catch (final Throwable e) {
throw new FieldValueInvalidException(name, value, e);
}
target.setValue(name, convertedValue);
}
}
return target;
} else {
throw new NoSuchElementException();
}
}
Aggregations