You have to define the name when constructing the DescriptorProto.
I have done this myself lately but unfortunately I am currently not in
the office.
But I can send you an example tomorrow of you like.

Kind regards
Robert

On 27 Jul., 16:36, Giancarlo Frison <[email protected]> wrote:
> if I call setTypeName(messageName), how protobuf match the name with
> related Descriptor?
> How can I map messageName and the descriptor of the type?
>
> On Jul 27, 3:56 pm, Robert <[email protected]> wrote:
>
>
>
> > Hi,
>
> > you either call setType() for primitive types or setTypeName(String)
> > for referenced messages.
> > You pass in the name of the message.
>
> > Kind regards,
> > Robert
>
> > On 27 Jul., 10:35, Giancarlo Frison <[email protected]> wrote:
>
> > > Thank you very much Pherl!
>
> > > An another question. What about not-primitive fields, or message
> > > fields?
>
> > > when I add fields I do:
>
> > >     DescriptorProtos.DescriptorProto.Builder desBuilder
> > >     ....
> > >     DescriptorProtos.FieldDescriptorProto.Builder fd1Builder =
> > > DescriptorProtos.FieldDescriptorProto.newBuilder()
> > >         .setName(fieldName).setNumber(i+
> > > +).setType(type).setLabel(label);
> > >     desBuilder.addField(fd1Builder.build());
>
> > > with message typed field I set type as
> > > 'DescriptorProtos.FieldDescriptorProto.Type.TYPE_MESSAGE'. How do I
> > > describe the field type?
> > > I mean, I suppose to describe the field with a inner
> > > 'DescriptorProtos.DescriptorProto.Builder', is it correct? How I can
> > > do to describe a complex type field?
>
> > > Thanks!
>
> > > On Jul 26, 8:21 pm, Pherl Liu <[email protected]> wrote:
>
> > > > Not sure if I understand your question correctly. You can set the label 
> > > > in
> > > > FieldDescriptorProto:
>
> > > > LABEL_OPTIONAL = 1;
>
> > > > LABEL_REQUIRED      = 2;LABEL_REPEATED      = 3;
>
> > > > On Tue, Jul 26, 2011 at 12:21 AM, Giancarlo Frison 
> > > > <[email protected]>wrote:
>
> > > > > There is this example that I'm approaching to re-implement
> > > > >http://flori.posterous.com/dynamically-creating-protocol-buffer-objects
>
> > > > > a question:
>
> > > > > How to handle repeated fields? How can you describe them in the
> > > > > fieldDescriptor?
>
> > > > > On Jul 18, 5:20 pm, yoave <[email protected]> wrote:
> > > > > > Hi all,
>
> > > > > > I've got 2 questions:
>
> > > > > > 1. how do I generate a Descriptor from a FileDescriptorProto in 
> > > > > > Java?
> > > > > >    In cpp, I'm using DescriptorPool class's 'BuildFile()'
> > > > > > functionality.
>
> > > > > > 2. how do I generate a Dynamic Message from a Descriptor in Java?
> > > > > >    In cpp, I'm using DynamicMessageFactory class's 'GetPrototype()'
> > > > > > functionality.
>
> > > > > > thanks
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google 
> > > > > Groups
> > > > > "Protocol Buffers" group.
> > > > > To post to this group, send email to [email protected].
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected].
> > > > > 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to