static Object readObjectFrom(Input input, Schema<?> schema, Object owner,
            IdStrategy strategy) throws IOException
    {
        final int number = input.readFieldNumber(schema);

        if (number == ID_POJO)
        {
            // AtomicInteger/AtomicLong
            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;
        }

        final Object value;
        switch (number)
        {
            case ID_BYTE:
                value = BYTE.readFrom(input);
                break;
            case ID_SHORT:
                value = SHORT.readFrom(input);
                break;
            case ID_INT32:
                value = INT32.readFrom(input);
                break;
            case ID_INT64:
                value = INT64.readFrom(input);
                break;
            case ID_FLOAT:
                value = FLOAT.readFrom(input);
                break;
            case ID_DOUBLE:
                value = DOUBLE.readFrom(input);
                break;
            case ID_BIGDECIMAL:
                value = BIGDECIMAL.readFrom(input);
                break;
            case ID_BIGINTEGER:
                value = BIGINTEGER.readFrom(input);
                break;
            default:
                throw new ProtostuffException("Corrupt input.");
        }

        if (input instanceof GraphInput)
        {
            // update the actual reference.
            ((GraphInput) input).updateLast(value, owner);
        }

        if (0 != input.readFieldNumber(schema))
            throw new ProtostuffException("Corrupt input.");

        return value;
    }
Used when the type is {@link java.lang.Number}.

@author David Yu
@created Apr 30, 2012
protostuff-runtime/src/main/java/io/protostuff/runtime/NumberSchema.java