Making a small change to a Java protocol buffers object

Another option is (I think; it’s been a while):

Foo.Builder fooBuilder = foo.toBuilder();
fooBuilder.getBarBuilder().getBazBuilder().getQuuxBuilder()
    .setNewThing(newThing);
newFoo = fooBuilder.build();

Note that this isn’t any more efficient; you’re still making copies of foo, bar, baz, and quux.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)