@Override
        public <T> Field<T> create(int number, String name,
                final java.lang.reflect.Field f, IdStrategy strategy)
        {
            return new Field<T>(FieldType.BYTES, number, name,
                    f.getAnnotation(Tag.class))
            {
                {
                    f.setAccessible(true);
                }

                public void mergeFrom(Input input, T message)
                        throws IOException
                {
                    try
                    {
                        f.set(message, new BigInteger(input.readByteArray()));
                    }
                    catch (IllegalAccessException e)
                    {
                        throw new RuntimeException(e);
                    }
                    catch (IllegalArgumentException e)
                    {
                        throw new RuntimeException(e);
                    }
                }

                public void writeTo(Output output, T message)
                        throws IOException
                {
                    try
                    {
                        BigInteger value = (BigInteger) f.get(message);
                        if (value != null)
                            output.writeByteArray(number, value.toByteArray(),
                                    false);
                    }
                    catch (IllegalAccessException e)
                    {
                        throw new RuntimeException(e);
                    }
                    catch (IllegalArgumentException e)
                    {
                        throw new RuntimeException(e);
                    }
                }

                public void transfer(Pipe pipe, Input input, Output output,
                        boolean repeated) throws IOException
                {
                    input.transferByteRangeTo(output, false, number, repeated);
                }
            };
        }
Field factory via plain old reflection api.

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