I am not familiar with the Spring framework, but how does it even know
about the private variable names? If it is somehow accessing the private
variables then I would worry that that would be a fragile setup, since the
private variables are an implementation detail that could change at any
time.

On Thu, Sep 6, 2018 at 10:27 AM Chris Zhang <[email protected]> wrote:

> Hi Adam,
>
> Thanks for the response.
>
> We are trying to persist the protobuf generated java object into mongoDB
> using Spring framework.
> However, when doing the querying from database, the spring framework does
> not support any field name with underscore.
>
> Is there anyway we can work around?
>
> Thanks.
>
>
> On Thursday, September 6, 2018 at 1:05:38 PM UTC-4, Adam Cozzette wrote:
>>
>> There is no way to remove the underscores without changing protoc. But
>> why do you want to get rid of the underscores anyway? Those variables are
>> just a private implementation detail and make no difference to the public
>> API.
>>
>> On Wed, Sep 5, 2018 at 1:07 PM Chris Zhang <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> I am new to Protobuf, and recently I found out that the java generated
>>> code by protobuf has underscore by the end of each field names.
>>>
>>> For example,
>>>
>>> protobuf message file look like this:
>>>
>>> message DummyMessage [
>>>
>>>     string some_id = 1;
>>>     bool is_active = 2;
>>> }
>>>
>>> The generated java code is like this:
>>>
>>> Class DummyMessage {
>>>
>>>     String someId_;
>>>     boolean isActive_;
>>>
>>> }
>>>
>>> Is there any way to get rid of the underscore of each field?
>>>
>>> Thanks,
>>>
>>>
>>> --
>>> 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 https://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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to