public void doMergeFrom(Input input, Schema<Object> schema,
                        Object message) throws IOException
                {
                    try
                    {
                        final Object existing = f.get(message);

                        // merge if not null and is same type.
                        final Object value = existing == null
                                || existing.getClass() != schema.typeClass() ? schema
                                .newMessage() : existing;

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

                        schema.mergeFrom(input, value);
                        f.set(message, value);
                    }
                    catch (IllegalAccessException e)
                    {
                        throw new RuntimeException(e);
                    }
                    catch (IllegalArgumentException e)
                    {
                        throw new RuntimeException(e);
                    }
                }
Field factory via plain old reflection api.

@author David Yu
@created Jul 7, 2011
protostuff-runtime/src/main/java/io/protostuff/runtime/RuntimeReflectionFieldFactory.java