private static Object readUnmodifiableCollectionFrom(Input input,
            Schema<?> schema, Object owner, IdStrategy strategy, boolean graph,
            Object collection, boolean ss, boolean list) throws IOException
    {
        if (graph)
        {
            // update the actual reference.
            ((GraphInput) input).updateLast(collection, owner);
        }

        final Wrapper wrapper = new Wrapper();
        Object c = input.mergeObject(wrapper,
                strategy.POLYMORPHIC_COLLECTION_SCHEMA);
        if (!graph || !((GraphInput) input).isCurrentMessageReference())
            c = wrapper.value;
        try
        {
            fUnmodifiableCollection_c.set(collection, c);

            if (ss)
                fUnmodifiableSortedSet_ss.set(collection, c);

            if (list)
                fUnmodifiableList_list.set(collection, c);
        }
        catch (IllegalAccessException e)
        {
            throw new RuntimeException(e);
        }
        catch (IllegalArgumentException e)
        {
            throw new RuntimeException(e);
        }

        return collection;
    }
Used when the type is an interface (Collection/List/Set/SortedSet).

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