- java.lang.Object
-
- de.carne.util.prefs.FilePreferencesFactory
-
- All Implemented Interfaces:
java.util.prefs.PreferencesFactory
public class FilePreferencesFactory extends java.lang.Object implements java.util.prefs.PreferencesFactoryCustom PreferencesFactory implementation for storing preferences into human readable text (*.conf) files.
-
-
Constructor Summary
Constructors Constructor Description FilePreferencesFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.prefs.PreferencescustomRoot(java.io.File file)Creates a Preferences object backed up by a custom configuration file.static java.util.prefs.PreferencescustomRoot(java.nio.file.Path file)Creates a Preferences object backed up by a custom configuration file.static java.util.prefs.PreferencescustomRoot(java.util.Properties data)Creates a Preferences object backed up by a Properties object.static java.nio.file.PathcustomRootFile(java.lang.String name)Gets the file path used to store custom preferences.static voidflush()Flush any file based FilePreferences instance to the backing store.java.util.prefs.PreferencessystemRoot()static java.nio.file.PathsystemRootFile()Gets the file path used to store system preferences.java.util.prefs.PreferencesuserRoot()static java.nio.file.PathuserRootFile()Gets the file path used to store user preferences.
-
-
-
Method Detail
-
systemRoot
public java.util.prefs.Preferences systemRoot()
- Specified by:
systemRootin interfacejava.util.prefs.PreferencesFactory
-
userRoot
public java.util.prefs.Preferences userRoot()
- Specified by:
userRootin interfacejava.util.prefs.PreferencesFactory
-
systemRootFile
public static java.nio.file.Path systemRootFile()
Gets the file path used to store system preferences.- Returns:
- the file path used to store system preferences.
-
userRootFile
public static java.nio.file.Path userRootFile()
Gets the file path used to store user preferences.- Returns:
- the file path used to store user preferences.
-
customRootFile
public static java.nio.file.Path customRootFile(java.lang.String name)
Gets the file path used to store custom preferences.- Parameters:
name- the file name to use.- Returns:
- the file path used to store custom preferences.
-
customRoot
public static java.util.prefs.Preferences customRoot(java.nio.file.Path file)
Creates a Preferences object backed up by a custom configuration file.The created Preferences object can be stored if the submitted custom configuration file is writable by the VM.
- Parameters:
file- the custom configuration file to use as a preference store.- Returns:
- the created Preferences object.
-
customRoot
public static java.util.prefs.Preferences customRoot(java.io.File file)
Creates a Preferences object backed up by a custom configuration file.The created Preferences object can be stored if the submitted custom configuration file is writable by the VM.
- Parameters:
file- the custom configuration file to use as a preference store.- Returns:
- the created Preferences object.
-
customRoot
public static java.util.prefs.Preferences customRoot(java.util.Properties data)
Creates a Preferences object backed up by a Properties object.The created Preferences object cannot be stored.
- Parameters:
data- the Properties object defining the preference data.- Returns:
- the created Preferences object.
-
flush
public static void flush()
Flush any file based FilePreferences instance to the backing store.
-
-