On Tuesday, July 11, 2017 at 5:09:30 PM UTC-7, Feng Xiao wrote:
> Actually you can't add a sub-builder to another builder. If you look at 
> the implementation of addDependencies(Builder), it just calls 
> builder.build() right away and add the resulted Chart object:
> https://microbean.github.io/microbean-helm/apidocs/src-html/hapi/chart/ChartOuterClass.Chart.Builder.html#line.1680

You're quite right of course; not sure how I missed that.

> You can instead get a sub-builder out from an existing builder, by calling 
> the getFieldBuilder() method, e.g., getDependenciesBuilder(int). This 
> sub-builder you get is "owned" by the parent builder and they are 
> cross-referenced: if you call build() on the parent builder, it will 
> recursively call build() on all its sub-builders; if you change the 
> sub-builder, its parent builder will get notified for the change.

And I add a sub-builder by...calling...addDependenciesBuilder(), with no 
arguments.  I guess.  This all feels very, very weird.

I wish I could use the actual top-level Chart.Builder to keep track of his 
tree of dependent Chart.Builders, but it looks like without some serious 
gymnastics this will be harder than just maintaining the hierarchy by hand 
out-of-band and then adding the immutable objects in the right places. 
 This feels cumbersome, which was why I was looking for a simpler way to do 
it.  Looks like there is no simpler way to do it.  Many thanks for your 


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 https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to