this (i.e. the same builder) - but the declared return type needs to be the concrete type involved, not just the interface, otherwise you couldn't then use the returned builder to set properties without casting.” source...
“In the first part of this series we saw that a message type and its builder are closely related. The tricky bit comes when we want to define an interface describing messages and builders. Although some members clearly depend on the data being built (the first and last name in the person example above, for instance) others apply to all messages or all builders. For instance, a message can always provide you with a suitable builder, and a builder always allows you to build it to create the actual message. Likewise the message and builder types also have methods which return other instances of themselves - you can ask any message for the default message of the same type, or clone a builder. Many common builder methods effectively return
Loading...