Extending builders: PathBuilder

Lubomir Nerad lubomir.nerad at oracle.com
Wed Nov 21 09:52:19 PST 2012

On 11/20/2012 3:46 PM, Richard Bair wrote:
>> There is one part which is unclear: What to do, if BOTH elements() and new methods (moveTo, etc.) are used? e.g.
>> PathBuilder.create().elements(new MoveTo(10,10)).lineTo(100,100).closePath().build();
>> or
>> PathBuilder.create().moveTo(10,10).lineTo(100,100).elemens(new ClosePath()).build();
>> There are several approaches for this :
>> 1.) appending everything into one list so both of former examples return the same path.
> This was my natural inclination. Is it really likely that we would break anybody if we decided to treat all such methods (like children()) in this way, where they are additive? I mean, does anybody have a builder with two calls to children where they expected the second to replace the first? It seems maybe this is a place where the spec should be changed?

What if somebody uses a single Group builder instance which is 
configured with common attributes and then used for building multiple 
Group-s each of them having different set of children. In that case I 
would expect children replacing and not adding to the existing list.

> Richard


More information about the openjfx-dev mailing list