// null values don't need no special treatment, they'll become nil
if (r[i] == null) {
rubyRow.put(field, null);
} else {
ValueMetaInterface vm = rowMeta.getValueMeta(i);
switch (vm.getType()) {
case ValueMeta.TYPE_BOOLEAN:
rubyRow.put(field, vm.getBoolean(r[i]));
break;
case ValueMeta.TYPE_INTEGER:
rubyRow.put(field, vm.getInteger(r[i]));
break;
case ValueMeta.TYPE_STRING:
rubyRow.put(field, vm.getString(r[i]));
break;
case ValueMeta.TYPE_NUMBER:
rubyRow.put(field, vm.getNumber(r[i]));
break;
case ValueMeta.TYPE_NONE:
rubyRow.put(field, r[i]);
break;
case ValueMeta.TYPE_SERIALIZABLE:
if (r[i] instanceof RubyStepMarshalledObject) {
Object restoredObject = getMarshal().callMethod(data.runtime.getCurrentContext(), "restore", data.runtime.newString(r[i].toString()));
rubyRow.put(field, restoredObject);
} else {
// try to put the object in there as it is.. should create a nice adapter for the java object
rubyRow.put(field, r[i]);
}
break;
case ValueMeta.TYPE_BINARY:
// put a ruby array with bytes in there, that is expensive and should probably be avoided
rubyRow.put(fieldNames[i],
data.runtime.newArrayNoCopy(JavaUtil.convertJavaArrayToRuby(data.runtime, ArrayUtils.toObject((byte[]) vm.getBinary(r[i]))))
);
break;
case ValueMeta.TYPE_BIGNUMBER:
IRubyObject bigDecimalObject = getBigDecimal().callMethod(data.runtime.getCurrentContext(), "new", data.runtime.newString((vm.getBigNumber(r[i])).toString()));
rubyRow.put(field, bigDecimalObject);
break;
case ValueMeta.TYPE_DATE:
rubyRow.put(field, data.runtime.newTime((vm.getDate(r[i])).getTime()));
break;
}
}