if (TRACE) trace("kryo", "Reading field: " + cachedField + " (" + type.getName() + ")");
Object value;
Class concreteType = cachedField.fieldClass;
Serializer serializer = cachedField.serializer;
if (concreteType == null) {
RegisteredClass registeredClass = kryo.readClass(buffer);
if (registeredClass == null)
value = null;
else {
concreteType = registeredClass.getType();
if (serializer == null) serializer = registeredClass.getSerializer();
value = serializer.readObjectData(buffer, concreteType);
}
} else {
if (serializer == null)
cachedField.serializer = serializer = kryo.getRegisteredClass(concreteType).getSerializer();
if (!cachedField.canBeNull)
value = serializer.readObjectData(buffer, concreteType);
else
value = serializer.readObject(buffer, concreteType);
}
cachedField.set(object, value);
} catch (IllegalAccessException ex) {
throw new SerializationException("Error accessing field: " + cachedField + " (" + type.getName() + ")", ex);