return arrayWrapper.array;
}
case ID_OBJECT:
if(input.readUInt32() != 0)
throw new ProtostuffException("Corrupt input.");
value = new Object();
break;
case ID_ARRAY_MAPPED:
{
final ArrayWrapper mArrayWrapper = newArrayWrapper(input, schema, true,
strategy);
if(input instanceof GraphInput)
{
// update the actual reference.
((GraphInput)input).updateLast(mArrayWrapper.array, owner);
}
strategy.COLLECTION_SCHEMA.mergeFrom(input, mArrayWrapper);
return mArrayWrapper.array;
}
case ID_CLASS:
value = strategy.resolveClassFrom(input, false, false);
break;
case ID_CLASS_MAPPED:
value = strategy.resolveClassFrom(input, true, false);
break;
case ID_CLASS_ARRAY:
value = getArrayClass(input, schema,
strategy.resolveClassFrom(input, false, true));
break;
case ID_CLASS_ARRAY_MAPPED:
value = getArrayClass(input, schema,
strategy.resolveClassFrom(input, true, true));
break;
case ID_ENUM:
{
final EnumIO<?> eio = strategy.resolveEnumFrom(input);
if(input.readFieldNumber(schema) != ID_ENUM_VALUE)
throw new ProtostuffException("Corrupt input.");
value = eio.readFrom(input);
break;
}
case ID_ENUM_SET:
{
final Collection<?> es = strategy.resolveEnumFrom(input).newEnumSet();
if(input instanceof GraphInput)
{
// update the actual reference.
((GraphInput)input).updateLast(es, owner);
}
strategy.COLLECTION_SCHEMA.mergeFrom(input, (Collection<Object>)es);
return es;
}
case ID_ENUM_MAP:
{
final Map<?,Object> em = strategy.resolveEnumFrom(input).newEnumMap();
if(input instanceof GraphInput)
{
// update the actual reference.
((GraphInput)input).updateLast(em, owner);
}
strategy.MAP_SCHEMA.mergeFrom(input, (Map<Object, Object>)em);
return em;
}
case ID_COLLECTION:
{
final Collection<Object> collection = strategy.resolveCollectionFrom(
input).newMessage();
if(input instanceof GraphInput)
{
// update the actual reference.
((GraphInput)input).updateLast(collection, owner);
}
strategy.COLLECTION_SCHEMA.mergeFrom(input, collection);
return collection;
}
case ID_MAP:
{
final Map<Object,Object> map =
strategy.resolveMapFrom(input).newMessage();
if(input instanceof GraphInput)
{
// update the actual reference.
((GraphInput)input).updateLast(map, owner);
}
strategy.MAP_SCHEMA.mergeFrom(input, map);
return map;
}
case ID_POLYMORPHIC_COLLECTION:
{
if(0 != input.readUInt32())
throw new ProtostuffException("Corrupt input.");
final Object collection = PolymorphicCollectionSchema.readObjectFrom(input,
strategy.POLYMORPHIC_COLLECTION_SCHEMA, owner, strategy);
if(input instanceof GraphInput)
{
// update the actual reference.
((GraphInput)input).updateLast(collection, owner);
}
return collection;
}
case ID_POLYMORPHIC_MAP:
{
if(0 != input.readUInt32())
throw new ProtostuffException("Corrupt input.");
final Object map = PolymorphicMapSchema.readObjectFrom(input,
strategy.POLYMORPHIC_MAP_SCHEMA, owner, strategy);
if(input instanceof GraphInput)
{
// update the actual reference.
((GraphInput)input).updateLast(map, owner);
}
return map;
}
case ID_DELEGATE:
{
final Delegate<Object> delegate = strategy.resolveDelegateFrom(input);
if(1 != input.readFieldNumber(schema))
throw new ProtostuffException("Corrupt input.");
value = delegate.readFrom(input);
break;
}
case ID_THROWABLE:
return PolymorphicThrowableSchema.readObjectFrom(input, schema, owner,
strategy, number);
case ID_POJO:
{
final Schema<Object> derivedSchema = strategy.resolvePojoFrom(
input, number).getSchema();
final Object pojo = derivedSchema.newMessage();
if(input instanceof GraphInput)
{
// update the actual reference.
((GraphInput)input).updateLast(pojo, owner);
}
derivedSchema.mergeFrom(input, pojo);
return pojo;
}
default:
throw new ProtostuffException("Corrupt input. Unknown field number: " + number);
}
if(input instanceof GraphInput)
{
// update the actual reference.
((GraphInput)input).updateLast(value, owner);
}
if(input.readFieldNumber(schema) != 0)
throw new ProtostuffException("Corrupt input.");
return value;
}