ReplicatableTypeModel<?> typeModel = (ReplicatableTypeModel)context.getTypeDomain().getTypeModel(clazz);
//
Map<FieldModel, Object> state = new HashMap<FieldModel, Object>();
TypeModel currentTypeModel = typeModel;
List<Bilto> biltos = new ArrayList<Bilto>();
while (currentTypeModel != null)
{
if (currentTypeModel instanceof ReplicatableTypeModel)
{
for (FieldModel fieldModel : currentTypeModel.getFields())
{
if (!fieldModel.isTransient())
{
switch (container.readInt())
{
case DataKind.NULL_VALUE:
state.put(fieldModel, null);
break;
case DataKind.OBJECT_REF:
int refId = container.readInt();
Object refO = idToObject.get(refId);
if (refO != null)
{
state.put(fieldModel, refO);
}
else
{
biltos.add(new Bilto(refId, fieldModel));
}
break;
case DataKind.OBJECT:
Object o = container.readObject();
state.put(fieldModel, o);
break;
}
}
}
}
currentTypeModel = currentTypeModel.getSuperType();
}
//
Object instance = instantiate(typeModel, state);