List of utility methods to do Preference Put
void | put(final String key, final boolean value) Stores a boolean value to the preferences object prefs.putBoolean(key, value); |
boolean | putBooleanDontOverwrite(Preferences prefs, String key, boolean value) put Boolean Dont Overwrite boolean overwrite = prefs.get(key, null) == null; if (overwrite) { prefs.putBoolean(key, value); return overwrite; |
void | putCLOB(Preferences prefs, String key, String clob) Store a character large object (CLOB) under the given key in the given preference node. if (clob == null) throw new NullPointerException("CLOB value cannot be null"); if (clob.length() < Preferences.MAX_VALUE_LENGTH && !isCheckVal(clob)) { removeCLOB(prefs, key); prefs.put(key, clob); return; prefs.put(key, getCheckVal(clob)); ... |
void | putList(String path, ArrayList Put a list of strings to preferences. Preferences prefs = createNode(path); if (prefs == null) return; prefs.putInt("size", list.size()); for (int i = 0; i < list.size(); ++i) prefs.put("element_" + i, list.get(i)); |
void | putPrefsBoolean(Preferences prefs, String key, boolean value, boolean def) put Prefs Boolean if (value != def) prefs.putBoolean(key, value); else prefs.remove(key); |
void | putPrefsStrings(Preferences prefs, String key, String[] strings) put Prefs Strings for (int i = 0; i < strings.length; i++) prefs.put(key + (i + 1), strings[i]); for (int i = strings.length; prefs.get(key + (i + 1), null) != null; i++) prefs.remove(key + (i + 1)); |
void | setLocale(final Locale l) Sets the new default locale. Locale.setDefault(l);
final Preferences p = Preferences.userRoot().node(PREFERENCE_NODE);
p.put(LOCALE, encodeLocale(l));
resourceBundle = null;
|
void | setPrefBoolean(Object context, final String key, final boolean value) set Pref Boolean prefs = Preferences.userRoot().node(context.getClass().getName()); prefs.putBoolean(key, value); |
void | setUserString(final String preferencesGroup, final String preferenceName, final String value) set User String final Preferences preferences = getUserPreferences(preferencesGroup);
preferences.put(preferenceName, value);
|
void | storeDiff(Preferences prefs, String key, int prev, int val, int defVal) store Diff if (prev != val) if (val == defVal) prefs.remove(key); else prefs.putInt(key, val); |