-
Notifications
You must be signed in to change notification settings - Fork 271
Storing and retrieving and Preferences #107
Conversation
I try to remember to put the gpg signing back in deploy, but it fails when I deploy, so I have to set it to install before every deploy. That's why it keeps changing :) I think the preference implementation has some issues, and I don't like the loose Since Maybe it's better to drop the lazy initialization and just perform the instantiation in the |
I will change it, the first version I showed you did something like that. |
Perfect :) Add to CHANGELOG as well :) |
So, I have been thinking about this. and if you want this after this, I will do it. But :) the java preferences are meant for an application, not for components like the current config is. To be honest I cannot find a decent usecase where I would store application wide preferences over different files. So making the preferences be able to do that sounds to me a bit like overkill. |
I agree that you probably don't want to put app wide preferences is different files. For The only problem I have with lazy init is that you can call it with a name argument that is actually just discarded if you have already initialised it. Apart from that, I'm good with it. I have never used Preferences myself, and you could just as well use config in a single class (think ConfigController), but as you pointed out, the files will be put in the folder you started the app from, so Preferences would be better for apps that are distributed without an installer. There might be something I'm missing here, I'll play with it tomorrow and get back to you, OK? |
I've looked at this again now. To solve the problem I mentioned (calling preferences with different node names are simply ignored, everything will go into the first node name), I propose changing the implementation to this: fun preferences(nodename: String? = null, op: Preferences.() -> Unit) {
val node = if (nodename != null) Preferences.userRoot().node(nodename) else Preferences.userNodeForPackage(FX.application.javaClass)
op(node)
} No nodename will result in the default, and any other node name will be returned correctly. What do you think? |
@ronsmits did you have a chance to look at this? :) |
Sorry I have been very occupied with other stuff these days. I tested this and yes this is fine. I will update my clone and push it |
…f you do give a "node name", you will always have to pass that node name along when calling preferences
Cool! Are you happy with it now, should I merge? |
Yes you can merge |
Merged manually :) |
Please review and comment