I have been checking protobuf for quite a while now and although it meets
most of the requirements for a project of mine there is something that I
have not been able to figure out. How do I modify the protobuf (java)
compiler such that every field in a message builder class also has a method
to add a listener object in order to receive notifications when its values
The idea is to use a Message.builder not only as a way to construct a
message but as a model of my system. I would keep an Message.builder
instance at both client and server and send messages to one another to
synchronize them. Therefore I am interested in knowing when does the state
of this builder changes in order to react accordingly.
I have checked the protobuf compiler and it should be pretty simple to add
a setObserver() function into the message.builder itself and a call to this
function on the setter of each field. The problem is that if I get a
message and I call mergeFrom() then the setters are not called directly but
the reflection api is used to decode and set the required values, thus
bipassing the setter of the modified fields.
My questions is then, how could I modify the protobuf (java) compiler such
that whenever a field value changes and an observer was set, the observer
function will be called?
Any ideas and/or feedback is much appreciated :)
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 post to this group, send email to firstname.lastname@example.org.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.