@Override
        public <T> Field<T> create(int number, java.lang.String name,
                final java.lang.reflect.Field f, IdStrategy strategy)
        {
            final boolean primitive = f.getType().isPrimitive();
            final long offset = us.objectFieldOffset(f);
            return new Field<T>(FieldType.FLOAT, number, name,
                    f.getAnnotation(Tag.class))
            {
                @Override
                public void mergeFrom(Input input, T message)
                        throws IOException
                {
                    if (primitive)
                        us.putFloat(message, offset, input.readFloat());
                    else
                        us.putObject(message, offset,
                                new Float(input.readFloat()));
                }

                @Override
                public void writeTo(Output output, T message)
                        throws IOException
                {
                    if (primitive)
                        output.writeFloat(number, us.getFloat(message, offset),
                                false);
                    else
                    {
                        Float value = (Float) us.getObject(message, offset);
                        if (value != null)
                            output.writeFloat(number, value.floatValue(), false);
                    }
                }

                @Override
                public void transfer(Pipe pipe, Input input, Output output,
                        boolean repeated) throws IOException
                {
                    output.writeFloat(number, input.readFloat(), repeated);
                }
            };
        }
Field factory via sun.misc.Unsafe.

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