Extending builders: PathBuilder

Richard Bair richard.bair at oracle.com
Tue Nov 20 06:46:03 PST 2012


> 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?

Richard


More information about the openjfx-dev mailing list