List of utility methods to do Preference Get
boolean | getPreference(String key, Boolean defaultValue) get Preference return prefs.getBoolean(key, defaultValue);
|
Preferences | getPreferences() Provides direct access to the preferences node where VCHILL configuration information is stored. return prefs;
|
Preferences | getPreferences(final Class> preferencesClass) get Preferences final String preferenceGroup = preferencesClass.getName(); return getUserPreferences(preferenceGroup); |
Preferences | getPrefs(Class> cls) get Prefs return Preferences.userNodeForPackage(cls);
|
String[] | getPrefsStrings(Preferences prefs, String key) get Prefs Strings ArrayList<String> arr = new ArrayList<String>(); for (int i = 0; i < 10000; i++) { String s = prefs.get(key + (i + 1), null); if (s == null) break; arr.add(s); return arr.toArray(new String[arr.size()]); ... |
String[] | getStringArray(final String key, final String[] defaultValue) Gets an array of string values from the preferences object try { String val = prefs.get(key, arrayToString(defaultValue)); if (val.equals("")) return new String[0]; return val.split("\\*"); } catch (Exception e) { return defaultValue; |
Preferences | getUserPreferences() Returns the root user preferences node. Preferences retVal = Preferences.userRoot().node(PREF_ROOT);
return retVal;
|
Preferences | getUserPreferences() Retrieves the preference package based on the specified preferenceClass return Preferences.userNodeForPackage(mainAppClass);
|
Preferences | getUserPreferences(final String preferenceGroup) get User Preferences final Preferences userRoot = Preferences.userRoot(); final Preferences preferences = userRoot.node(preferenceGroup); return preferences; |
Preferences | getUserPrefsNode(Object mainClassInstance) Gets the Preferences node for a package, given one class in the package (either by reference or by reference to its Class object). Class clazz; if (mainClassInstance instanceof Class) clazz = (Class) mainClassInstance; else clazz = mainClassInstance.getClass(); return Preferences.userNodeForPackage(clazz); |