A Proxy to Preferences?

M

Mark

I want to implement my own PreferencesFactory to serve requests for
java.util.prefs.Preferences by setting -
Djava.util.prefs.PreferencesFactory=foo.Bar, but I want to forward
some calls in my Preferences class onto WindowsPreferences (the
default in the Windows JRE).

Looking in the JRE sources I see that WindowsPreferences and
WindowsPreferencesFactory are package-private, and I can't use the
Preference factory methods witing foo.Bar (or I will just be calling
myself again).

So what is the best way of accessing the default preferences factory?
Is it as simple and ugly as temporarily resetting the relevant system
property from "foo.Bar" to "java.util.prefs.WindowsPreferencesFactory"
inside the methods of my new Preferences class?

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top