Hi Ilia,
Yes you got my question correct.
So do you mean that I should fill the proto buffer object manually(if not
by reflection) using setters provided in proto buffer builder?

Thanks,
Pratz




On Fri, Aug 9, 2013 at 11:19 AM, Ilia Mirkin <[email protected]> wrote:

> Is your basic question "is there an easy way to convert between a type
> I created and a vastly similar type created by protoc"? AFAIK the
> answer is no, definitely not in the core protobuf library. However it
> shouldn't be too difficult to create something that handles most cases
> with reflection. (And if you run into a reference loop, throw an
> error, since that's fundamentally non-encodable using protobuf.)
> However note that Java reflection is slow, and protobuf is often used
> in applications where this stuff needs to be fast. Furthermore your
> internal models invariably diverge from the protobuf stuff, and so you
> end up with a bunch of fromProto/toProto functions anyways...
>
> On Fri, Aug 9, 2013 at 1:36 AM, prateek sharma <[email protected]>
> wrote:
> > Is it something that I did not get properly w.r.t. mapper or is my
> question
> > invalid?
> >
> > Thanks,
> > Pratz
> >
> >
> > On Thursday, August 8, 2013 6:20:51 PM UTC+5:30, prateek sharma wrote:
> >>
> >> Hi all,
> >> I am new to buffers, using it with my java project.
> >> I have one doubt about initializing proto buffer entities.
> >>
> >> Initializing this proto buffer entity is done manually in all the
> examples
> >> given in tutorial, examples used setters to set the values directly to
> proto
> >> buffer entities but what when I have a base entity which I want to
> convert
> >> to proto buffer entity? Do I need to take values from the base entity
> and
> >> initialize proto buffer entity or there are any mapper available to do
> this
> >> task?
> >>
> >> For example:
> >> In my project if I have a base entity vehicle which has parameters as
> >> id        int
> >> name  String
> >> type    int
> >>
> >> I wrote a .proto file vehicle.proto as
> >> message vehicle_proto{
> >>      required int32 id = 1; // Unique ID number for this person.
> >>      required string name = 2;
> >>      optional string type = 3;
> >> }
> >>
> >> It created a file VehicleProto.java.
> >>
> >> Now I have one entity vehicle and one entity VehicleProto and want to
> map
> >> vehicle to VehicleProto. How can I do it automatically?
> >>
> >> Thanks,
> >> Pratz
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Protocol Buffers" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to [email protected].
> > To post to this group, send email to [email protected].
> > Visit this group at http://groups.google.com/group/protobuf.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to