I'm confused. You mention using pure Java reflection, yet you also said you
are trying to do some stuff with protobuf reflection. You should not be
using Java reflection at all.

To get the field type, as defined in the .proto file, use
FieldDescriptor.getType()

On Tue, Sep 7, 2010 at 6:29 AM, narfm...@yahoo.com <narfm...@gmail.com>wrote:

> Hello,
>
> I am using the google protocol buffer reflection api to try to
> dynamically create a gui for users to fill in Messages manually. I had
> done this completely using Java reflection alone, but this eventually
> led to problems synchronizing the data, and was all around more work
> than google's reflection api should be.
>
> I have implemented as follows: I pass a Descriptor into the main
> JPanel building function. From here, it iterates over the fields, and
> if it is integral, it makes a JTextField, and if it is a Message, it
> calls the same function again. What I can not find out is the type
> that the fielddescriptor as I am iterating over the fields from the
> descriptor. It appears that one "should" be able to figure this out in
> several ways, but none work for me.
>
> First I thought it must be soemthing in JavaType, but that appears to
> only be what google protocol buffers converted the .proto into. Next I
> thought I could get the full package name and me a newInstance of it,
> but when calling fullName, it only returns the class name and no
> package name. Next, I tried getting the file and querying it's package
> name, but it returns "".
>
> Like I said above, I implemented all of this in pure java reflection,
> and the .proto generates the .class files correctly with fully
> qualified names, but the google protocol buffer reflection api (using
> descriptors and field descriptors) does not give me enough
> information. Anyone have any ideas as to why it's not giving me what I
> want?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to proto...@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to