[REVIEW] Make controller instantiation customizable

Greg Brown greg.x.brown at oracle.com
Fri Dec 16 16:00:55 PST 2011

> I think we're crossing wires. I'm talking about the:
> <param fx:id="someParameterInTheNamedParametersMap" />
> not passing the String to the controller factory.

OK, thanks for clarifying. So what would be the use case for this feature? Where would I apply a <param> tag, and why?

>> A developer will have to look a lot more closely at the Javadoc for setControllerFactory() to understand what a "callback" is in this context, and what call() will actually do. A dedicated interface is clearer, yet will be equally applicable to lambdas in Java 8.
> I know the argument well. The same question has come up in multiple places in the platform. If we went with one-off interfaces, the interface names and method names would be much clearer and more specific. On the other hand, there would be more class files.

I'm not sure how much of an issue that really is in practice. As I recall, we use a lot of anonymous inner classes, which also add to the total class count. JavaFX is a framework, so in my opinion API clarity is much a more important consideration.

> In the end, I think we need to use a Callback here. We've already faced and made this decision for the other parts of the platform, so it makes sense to be consistent here.

It would be consistent with other unrelated parts of the platform, but not with the BuilderFactory interface, which is used by FXMLLoader and is already defined similarly to ControllerFactory.


More information about the openjfx-dev mailing list