@Override
    @SuppressWarnings("unchecked")
    public <T> T mergeObject(T value, Schema<T> schema) throws IOException
    {
        if (messageReference)
        {
            // a reference.
            return (T) references.get(lastRef);
        }

        lastSchema = (Schema<Object>) schema;

        if (value == null)
            value = schema.newMessage();

        references.add(value);

        input.mergeObject(value, this);

        return value;
    }
A CodedInput w/c can handle cyclic dependencies when deserializing objects with graph transformations.

@author David Yu
@created Jan 17, 2011
protostuff-core/src/main/java/io/protostuff/GraphCodedInput.java