[protobuf] JsonFormat parser use camel field name in proto3 beta1

2015-09-24 Thread sam sun
I have a proto:
  message Person {
 string user_id;
  }
and write a json:
   { "user_id" : "123" }

I try to use JsonFormat.Parser to parse the json, but it failed. I found 
JsonFormat 
will call fieldNameToCamelName. I'm really confused. If the parser in java 
required camel fieldname, the parser in c++ required user_id or userId ? 
I think it's better to let the field name reserved the same as defined in 
proto or supply a optional to set whether convert the field name to camel.

-- 
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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Custom (overriden) getters & setters

2015-09-24 Thread Pavol Ostertag
I see insertion points inside getters and setters in new protobufs. Thank
you, this is exactly what I needed.


2015-07-13 19:50 GMT+02:00 Pavol Ostertag :

> Thank you. However, your proposed solution uncovers otherwise transparent
> behavior of the field. It puts a responsibility of encryption handling on
> author of the data, instead on the DTO (data transfer object) itself.
>
> With "insertion point" (let's call it so despite it likely will not be
> one) you can get always string value (as it is defined) which is
> transparently encoded (as the value of the option dictates).
>
> 2015-07-13 19:43 GMT+02:00 Feng Xiao :
>
>> On Mon, Jul 13, 2015 at 9:47 AM, Pavol Ostertag > > wrote:
>>
>>> Is it possible to generate custom getters and setters for certain field?
>>> Are there any field-level "insertion points" planned?
>>>
>> We add "insertion points" per user requests. Feel free to send us PRs to
>> add insertion points that you think are needed.
>>
>>
>>>
>>> My use-case: I have field with option=encrypted. I want to encrypt
>>> content of this (string) field after everyset() and decrypt before every
>>> get().
>>>
>> It's unlikely that "insertion points" can be used to change the behavior
>> of existing generated methods (like get()/set()). I suggest adding some new
>> methods for your use case instead. Something like
>> get_encrypted()/set_encrypted().
>>
>>
>>>
>>> Thank you
>>>
>>> --
>>> 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 protobuf+unsubscr...@googlegroups.com.
>>> To post to this group, send email to protobuf@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/protobuf.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>

-- 
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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.