public class Pref
extends java.lang.Object
Some Prefs can be used in server Jobs, other are client only. Server Prefs are created by special factory methods during Electric initialization. They can't be created later.
All options are saved in a machine-specific way by the Java Preferences class. In addition, "meaning" options are stored in libraries. When the libraries are read back into Electric, the stored meaning options are checked against the current meaning options, the two are reconciled.
Where are these options stored? It varies with each operating system.
Modifier and Type | Class and Description |
---|---|
static class |
Pref.Group |
Modifier and Type | Field and Description |
---|---|
static boolean |
FROM_THREAD_ENVIRONMENT |
Modifier | Constructor and Description |
---|---|
protected |
Pref(Pref.Group group,
java.lang.String name,
boolean serverAccessible,
java.lang.Object factoryObj)
The constructor for the Pref.
|
Modifier and Type | Method and Description |
---|---|
static void |
delayPrefFlushing()
Method to delay the saving of preferences to disk.
|
static void |
exportPrefs(java.lang.String fileName)
Method to export the preferences to an XML file.
|
static void |
exportPrefs(java.lang.String fileName,
java.util.prefs.Preferences prefRoot)
Method to export the preferences to an XML file.
|
void |
factoryReset()
Method to reset Pref value to factory default.
|
static void |
flushAll()
Method to immediately flush all Electric preferences to disk.
|
static void |
forbidPreferences() |
static java.util.Collection<Pref.Group> |
getAllGroups() |
boolean |
getBoolean()
Method to get the boolean value on this Pref object.
|
boolean |
getBoolean(java.util.prefs.Preferences prefRoot)
Method to get the boolean value on this Pref object.
|
boolean |
getBooleanFactoryValue()
Method to get the factory-default boolean value of this Pref object.
|
double |
getDouble()
Method to get the double value on this Pref object.
|
double |
getDouble(java.util.prefs.Preferences prefRoot)
Method to get the double value on this Pref object.
|
double |
getDoubleFactoryValue()
Method to get the factory-default double value of this Pref object.
|
static java.util.prefs.Preferences |
getFactoryPrefRoot()
Returns the root of dummy Preferences subtree with factory default Electric options.
|
java.lang.Object |
getFactoryValue()
Method to get the factory-default value of this Pref object.
|
int |
getInt()
Method to get the integer value on this Pref object.
|
int |
getInt(java.util.prefs.Preferences prefRoot)
Method to get the integer value on this Pref object.
|
int |
getIntFactoryValue()
Method to get the factory-default integer value of this Pref object.
|
static java.util.prefs.Preferences |
getLibraryPreferences(LibId libId)
Returns the root of Preferences subtree with Electric options for a specified LibId.
|
long |
getLong()
Method to get the long value on this Pref object.
|
long |
getLong(java.util.prefs.Preferences prefRoot)
Method to get the long value on this Pref object.
|
long |
getLongFactoryValue()
Method to get the factory-default long value of this Pref object.
|
java.lang.String |
getPrefName()
Method to get the name of this Pref object.
|
java.lang.String |
getPrefPath()
Method to get the pref name of this Pref object.
|
static java.util.prefs.Preferences |
getPrefRoot()
Returns the root of Preferences subtree with Electric options.
|
java.lang.String |
getString()
Method to get the string value on this Pref object.
|
java.lang.String |
getString(java.util.prefs.Preferences prefRoot)
Method to get the string value on this Pref object.
|
java.lang.String |
getStringFactoryValue()
Method to get the factory-default String value of this Pref object.
|
java.lang.Object |
getValue()
Method to get the value of this Pref object as an Object.
|
java.lang.Object |
getValue(java.util.prefs.Preferences prefRoot) |
static Pref.Group |
groupForPackage(java.lang.Class classFromPackage) |
static Pref.Group |
groupForPackage(java.lang.String relativePath) |
static void |
importPrefs(java.net.URL fileURL) |
static void |
lockCreation()
Currently Setting can be created only at initialization phase.
|
static Pref |
makeBooleanPref(java.lang.String name,
Pref.Group group,
boolean factory)
Factory methods to create a boolean Pref objects.
|
static Pref |
makeBooleanServerPref(java.lang.String name,
Pref.Group group,
boolean factory)
Factory methods to create a boolean Pref objects.
|
static Pref |
makeDoublePref(java.lang.String name,
Pref.Group group,
double factory)
Factory methods to create a double Pref objects.
|
static Pref |
makeIntPref(java.lang.String name,
Pref.Group group,
int factory)
Factory methods to create an integer Pref objects.
|
static Pref |
makeIntServerPref(java.lang.String name,
Pref.Group group,
int factory)
Factory methods to create an integer Pref objects.
|
static Pref |
makeLongPref(java.lang.String name,
Pref.Group group,
long factory)
Factory methods to create a long Pref objects.
|
static Pref |
makeStringPref(java.lang.String name,
Pref.Group group,
java.lang.String factory)
Factory methods to create a string Pref objects.
|
static Pref |
makeStringServerPref(java.lang.String name,
Pref.Group group,
java.lang.String factory)
Factory methods to create a string Pref objects.
|
void |
putBoolean(java.util.prefs.Preferences prefRoot,
boolean removeDefaults,
boolean v)
Method to set a new boolean value on this Pref object.
|
void |
putDouble(java.util.prefs.Preferences prefRoot,
boolean removeDefaults,
double v)
Method to set a new double value on this Pref object.
|
void |
putInt(java.util.prefs.Preferences prefRoot,
boolean removeDefaults,
int v)
Method to set a new integer value on this Pref object.
|
void |
putLong(java.util.prefs.Preferences prefRoot,
boolean removeDefaults,
long v)
Method to set a new long value on this Pref object.
|
void |
putString(java.util.prefs.Preferences prefRoot,
boolean removeDefaults,
java.lang.String str)
Method to set a new string value on this Pref object.
|
static void |
resumePrefFlushing()
Method to resume the saving of preferences to disk.
|
void |
setBoolean(boolean v)
Method to set a new boolean value on this Pref object.
|
static void |
setCachedObjsFromPreferences() |
void |
setDouble(double v)
Method to set a new double value on this Pref object.
|
void |
setInt(int v)
Method to set a new integer value on this Pref object.
|
void |
setLong(long v)
Method to set a new long value on this Pref object.
|
void |
setString(java.lang.String str)
Method to set a new string value on this Pref object.
|
public static final boolean FROM_THREAD_ENVIRONMENT
protected Pref(Pref.Group group, java.lang.String name, boolean serverAccessible, java.lang.Object factoryObj)
name
- the name of this Pref.public static Pref.Group groupForPackage(java.lang.Class classFromPackage)
public static Pref.Group groupForPackage(java.lang.String relativePath)
public static void lockCreation()
public static void forbidPreferences()
public static void setCachedObjsFromPreferences()
public static void importPrefs(java.net.URL fileURL)
public static void exportPrefs(java.lang.String fileName)
fileName
- the file to write.public static void exportPrefs(java.lang.String fileName, java.util.prefs.Preferences prefRoot)
fileName
- the file to write.public static Pref makeBooleanPref(java.lang.String name, Pref.Group group, boolean factory)
name
- the name of this Pref.group
- group of preferences to which a new Pref belongsfactory
- the "factory" default value (if nothing is stored).public static Pref makeIntPref(java.lang.String name, Pref.Group group, int factory)
name
- the name of this Pref.group
- group of preferences to which a new Pref belongsfactory
- the "factory" default value (if nothing is stored).public static Pref makeLongPref(java.lang.String name, Pref.Group group, long factory)
name
- the name of this Pref.group
- group of preferences to which a new Pref belongsfactory
- the "factory" default value (if nothing is stored).public static Pref makeDoublePref(java.lang.String name, Pref.Group group, double factory)
name
- the name of this Pref.group
- group of preferences to which a new Pref belongsfactory
- the "factory" default value (if nothing is stored).public static Pref makeStringPref(java.lang.String name, Pref.Group group, java.lang.String factory)
name
- the name of this Pref.group
- group of preferences to which a new Pref belongsfactory
- the "factory" default value (if nothing is stored).public static Pref makeBooleanServerPref(java.lang.String name, Pref.Group group, boolean factory)
name
- the name of this Pref.group
- group of preferences to which a new Pref belongsfactory
- the "factory" default value (if nothing is stored).public static Pref makeIntServerPref(java.lang.String name, Pref.Group group, int factory)
name
- the name of this Pref.group
- group of preferences to which a new Pref belongsfactory
- the "factory" default value (if nothing is stored).public static Pref makeStringServerPref(java.lang.String name, Pref.Group group, java.lang.String factory)
name
- the name of this Pref.group
- group of preferences to which a new Pref belongsfactory
- the "factory" default value (if nothing is stored).public boolean getBoolean()
public int getInt()
public long getLong()
public double getDouble()
public java.lang.String getString()
public boolean getBoolean(java.util.prefs.Preferences prefRoot)
prefRoot
- root Preferences nodepublic int getInt(java.util.prefs.Preferences prefRoot)
prefRoot
- root Preferences nodepublic long getLong(java.util.prefs.Preferences prefRoot)
prefRoot
- root Preferences nodepublic double getDouble(java.util.prefs.Preferences prefRoot)
prefRoot
- root Preferences nodepublic java.lang.String getString(java.util.prefs.Preferences prefRoot)
prefRoot
- root Preferences nodepublic java.lang.Object getFactoryValue()
public boolean getBooleanFactoryValue()
public int getIntFactoryValue()
public long getLongFactoryValue()
public double getDoubleFactoryValue()
public java.lang.String getStringFactoryValue()
public java.lang.String getPrefName()
public java.lang.String getPrefPath()
public java.lang.Object getValue()
public java.lang.Object getValue(java.util.prefs.Preferences prefRoot)
public static void delayPrefFlushing()
public static void resumePrefFlushing()
public static java.util.prefs.Preferences getPrefRoot()
public static java.util.prefs.Preferences getLibraryPreferences(LibId libId)
libId
- specified LibIdpublic static java.util.prefs.Preferences getFactoryPrefRoot()
public static void flushAll()
public void setBoolean(boolean v)
v
- the new boolean value of this Pref object.public void setInt(int v)
v
- the new integer value of this Pref object.public void setLong(long v)
v
- the new long value of this Pref object.public void setDouble(double v)
v
- the new double value of this Pref object.public void setString(java.lang.String str)
str
- the new string value of this Pref object.public void putBoolean(java.util.prefs.Preferences prefRoot, boolean removeDefaults, boolean v)
v
- the new boolean value of this Pref object.public void putInt(java.util.prefs.Preferences prefRoot, boolean removeDefaults, int v)
v
- the new integer value of this Pref object.public void putLong(java.util.prefs.Preferences prefRoot, boolean removeDefaults, long v)
v
- the new long value of this Pref object.public void putDouble(java.util.prefs.Preferences prefRoot, boolean removeDefaults, double v)
v
- the new double value of this Pref object.public void putString(java.util.prefs.Preferences prefRoot, boolean removeDefaults, java.lang.String str)
str
- the new string value of this Pref object.public void factoryReset()
public static java.util.Collection<Pref.Group> getAllGroups()