private static <T> Field<T> createMapPojoKInlineV(int number, String name,
            final java.lang.reflect.Field f, final MessageFactory messageFactory,
            final Class<Object> clazzK, final Delegate<Object> inlineV,
            IdStrategy strategy)
    {
        final HasSchema<Object> schemaK = strategy.getSchemaWrapper(clazzK,
                true);

        return new RuntimeMapField<T, Object, Object>(FieldType.MESSAGE,
                number, name, f.getAnnotation(Tag.class), messageFactory)
        {
            final Accessor accessor = AF.create(f);

            @Override
            @SuppressWarnings("unchecked")
            protected void mergeFrom(Input input, T message) throws IOException
            {
                accessor.set(message, input.mergeObject(
                        (Map<Object, Object>) accessor.get(message), schema));
            }

            @Override
            @SuppressWarnings("unchecked")
            protected void writeTo(Output output, T message) throws IOException
            {
                final Map<Object, Object> existing = accessor.get(message);

                if (existing != null)
                    output.writeObject(number, existing, schema, false);
            }

            @Override
            protected void transfer(Pipe pipe, Input input, Output output,
                    boolean repeated) throws IOException
            {
                output.writeObject(number, pipe, schema.pipeSchema, repeated);
            }

            @Override
            protected Object kFrom(Input input,
                    MapWrapper<Object, Object> wrapper) throws IOException
            {
                return input.mergeObject(null, schemaK.getSchema());
            }

            @Override
            protected void kTo(Output output, int fieldNumber, Object key,
                    boolean repeated) throws IOException
            {
                if (!clazzK.isAssignableFrom(key.getClass()))
                {
                    throw new RuntimeException(f.getDeclaringClass().getName() + 
                            "::" + f.getName() + " - " + key.getClass().getName() + 
                            " is not assignable to " + clazzK.getName());
                }
                output.writeObject(fieldNumber, key, schemaK.getSchema(),
                        repeated);
            }

            @Override
            protected void kTransfer(Pipe pipe, Input input, Output output,
                    int number, boolean repeated) throws IOException
            {
                output.writeObject(number, pipe, schemaK.getPipeSchema(),
                        repeated);
            }

            @Override
            protected void vPutFrom(Input input,
                    MapWrapper<Object, Object> wrapper, Object key)
                    throws IOException
            {
                wrapper.put(key, inlineV.readFrom(input));
            }

            @Override
            protected void vTo(Output output, int fieldNumber, Object val,
                    boolean repeated) throws IOException
            {
                inlineV.writeTo(output, fieldNumber, val, repeated);
            }

            @Override
            protected void vTransfer(Pipe pipe, Input input, Output output,
                    int number, boolean repeated) throws IOException
            {
                inlineV.transfer(pipe, input, output, number, repeated);
            }
            
            @Override
            protected Field<T> copy(IdStrategy strategy)
            {
                return createMapPojoKInlineV(number, name, f, messageFactory, clazzK, 
                        inlineV, strategy);
            }
        };
    }
Static utility for creating runtime {@link java.util.Map} fields.

@author David Yu
@created Jan 21, 2011
protostuff-runtime/src/main/java/io/protostuff/runtime/RuntimeMapFieldFactory.java