}
}
private static void fillObject(JODBSession session, boolean delayedActivation, ObjectDataContainer objectDataContainer, Object instance, int remainingDepth) throws IOException{
ClassDescriptor classDescriptor = session.getDescriptorForClass(instance.getClass());
IOBase base = session.getBase();
FieldsIterator fieldsIterator = objectDataContainer.getActiveFieldsIterator();
if(fieldsIterator == null){
return;
}
BitSet processedFieldMask = new BitSet();
FieldRecord record = objectDataContainer.getRecordCache();
for (int i = 0; fieldsIterator.hasNext(); i++) {
fieldsIterator.next(record, base);
Field field = classDescriptor.getFieldForID(record._fieldID, processedFieldMask);
if (field == null) {
continue;
}
if (field.getType().isPrimitive() && !delayedActivation) {
try {
field.set(instance, record._value);
} catch (Exception e) {
setDefaultValue(instance, field);
//TODO add debug level output
}
continue;
}
if (remainingDepth < 1) {
continue;
}
Object child = TransactionUtils.launchObject(session, record._objectOffset, null, remainingDepth - 1);
try {
if(child!=null || JODBConfig.isAllowNullInReflectionSet()){
field.set(instance, child);
}
} catch (Exception e) {
setDefaultValue(instance, field);
//TODO add debug level output
continue;
}
}
if (!delayedActivation) {
FieldAndIDRecord[] fields = classDescriptor.getAllFields();
for (int i = 0; i < fields.length; i++) {//set default values for remaining fields
if (processedFieldMask.get(i)) {
continue;
}
setDefaultValue(instance, fields[i]._field);