@Override
            public void mergeFrom(Input input, Entry<Object, Object> message)
                    throws IOException
            {
                // Nobody else calls this except MAP_SCHEMA.mergeFrom
                final PMapWrapper entry = (PMapWrapper) message;

                Object key = null, value = null;
                for (int number = input.readFieldNumber(this);; number = input
                        .readFieldNumber(this))
                {
                    switch (number)
                    {
                        case 0:
                            entry.map.put(key, value);
                            return;
                        case 1:
                            if (key != null)
                            {
                                throw new ProtostuffException(
                                        "The map was incorrectly serialized.");
                            }
                            key = input.mergeObject(entry, DYNAMIC_VALUE_SCHEMA);
                            if (entry != key)
                            {
                                // a reference.
                                assert key != null;
                            }
                            else
                            {
                                // entry held the key
                                key = entry.setValue(null);
                                assert key != null;
                            }
                            break;
                        case 2:
                            if (value != null)
                            {
                                throw new ProtostuffException(
                                        "The map was incorrectly serialized.");
                            }
                            value = input.mergeObject(entry, DYNAMIC_VALUE_SCHEMA);
                            if (entry != value)
                            {
                                // a reference.
                                assert value != null;
                            }
                            else
                            {
                                // entry held the value
                                value = entry.setValue(null);
                                assert value != null;
                            }
                            break;
                        default:
                            throw new ProtostuffException("The map was incorrectly serialized.");
                    }
                }
            }
This base class handles all the IO for reading and writing polymorphic fields. When a field's type is
polymorphic/dynamic (e.g interface/abstract/object), the type (id) needs to be written (ahead) before its
value/content to be able to deserialize it correctly.
<p>
The underlying impl will determine how the type (id) should be written.
<p>
An {@link IdStrategy} is standalone if the {@link #primaryGroup} is not set.

@author Leo Romanoff
@author David Yu
protostuff-runtime/src/main/java/io/protostuff/runtime/IdStrategy.java