Re: [protobuf] Re: why protobuf optional field does not take null

2017-04-22 Thread Louis Cognault
Or you can use extension functions in Kotlin ;) On Monday, March 20, 2017 at 12:53:43 PM UTC+1, Subin Sebastian wrote: > > 8 years later, still the only solution I have is, > > *class MyImprovedClass extends MyClass { // MyClass is protoc generated* > *public void setOrClearFoo(String value)

Re: [protobuf] Re: why protobuf optional field does not take null

2017-03-20 Thread Josh Humphries
In a past life, we used a protoc plugin that just added these setOrClear* to every builder for each non-repeated field (as well as getOrNull* methods for every message). The standard generated java code has insertion points that make this a fairly trivial plugin to write. We also experimented with

Re: [protobuf] Re: why protobuf optional field does not take null

2017-03-20 Thread Subin Sebastian
8 years later, still the only solution I have is, *class MyImprovedClass extends MyClass { // MyClass is protoc generated* *public void setOrClearFoo(String value) {* *if(value != null) setFoo(value);* *else clearFoo();* *}* *}* On Tuesday, December 1, 2009 at 7:04:26 AM

Re: [protobuf] Re: why protobuf optional field does not take null

2009-11-30 Thread Henner Zeller
Hi, On Mon, Nov 30, 2009 at 15:16, dp decimusphos...@gmail.com wrote: Is this still true? Or is there some way to tell PB that a field can potentially have null values? No change here. Problem is that 'null' and 'cleared' are semantically different things. Sometimes in the software world