-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
None
Currently the application parameters of a JavaFX app are stored in a Parameters instance inside the Application instance. The problem with this approach is that every part of a program that needs access to program parameters need access to either the Application instance or the Parameters instance.
In a JavaFX app this means you have to write extra code in order for different parts of a program to be able to reach the parameters. Similar for third party JavaFX frameworks.
There are in practice a ton of reasons why a framework could need access to application parameters and also the application object itself. Our framework reacts to program arguments on the command line, but for that to work, we have to have developers hand us the Application instance, which seems silly, since this could just be a singleton.
I hereby request the implementation of 1 static getInstance() method in the Application class which would allow all parts of an application and even third party frameworks to write code like
Application application = Application.getInstance();
boolean fooEnabled = application.getParameters().getNamed().contains("foo");
But if application parameters are all we need access to, why turn the whole Application into a singleton? Well, third party frameworks like ours could ask developers to implement an interface in their application, and then our framework could do cool things like
((TheFrameworkInterface) Application.getInstance()).doSomething();
In a JavaFX app this means you have to write extra code in order for different parts of a program to be able to reach the parameters. Similar for third party JavaFX frameworks.
There are in practice a ton of reasons why a framework could need access to application parameters and also the application object itself. Our framework reacts to program arguments on the command line, but for that to work, we have to have developers hand us the Application instance, which seems silly, since this could just be a singleton.
I hereby request the implementation of 1 static getInstance() method in the Application class which would allow all parts of an application and even third party frameworks to write code like
Application application = Application.getInstance();
boolean fooEnabled = application.getParameters().getNamed().contains("foo");
But if application parameters are all we need access to, why turn the whole Application into a singleton? Well, third party frameworks like ours could ask developers to implement an interface in their application, and then our framework could do cool things like
((TheFrameworkInterface) Application.getInstance()).doSomething();