Package org.openstreetmap.josm.data
Class PreferencesUtils
java.lang.Object
org.openstreetmap.josm.data.PreferencesUtils
Helper class to do specific Preferences operation - appending, replacing, deletion by key and by value
- Since:
- 12634 (extracted from
CustomConfigurator)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidappendPreferences(Preferences fragment, Preferences mainpref) private static voidstatic voiddeletePreferenceKey(String key, Preferences pref) static voiddeletePreferenceKeyByPattern(String pattern, Preferences pref) static voiddeletePreferenceValues(Preferences fragment, Preferences mainpref) Delete items frommainprefcollections that match items fromfragmentcollections.static booleangetBoolean(IPreferences prefs, String key, String specName, boolean def) Gets an boolean that may be specializedstatic intgetInteger(IPreferences prefs, String key, String specName, int def) Gets an integer that may be specializedgetList(Preferences mainpref, String key, boolean warnUnknownDefault) getListOfLists(Preferences mainpref, String key, boolean warnUnknownDefault) getListOfStructs(Preferences mainpref, String key, boolean warnUnknownDefault) static StringgetLog()Returns the log.static voidLog an exception.static voidLog a message.static voidLog a formatted message.static booleanputListBounded(IPreferences prefs, String key, int maxsize, List<String> val) Saves at mostmaxsizeitems of listval.static voidremoveFromList(IPreferences prefs, String key, String value) Removes a value from a given String liststatic voidreplacePreferences(Preferences fragment, Preferences mainpref) static voidresetLog()Resets the log.static voidshowPrefs(Preferences tmpPref)
-
Field Details
-
summary
-
-
Constructor Details
-
PreferencesUtils
private PreferencesUtils()
-
-
Method Details
-
log
Log a formatted message.- Parameters:
fmt- formatvars- arguments- Since:
- 12826
- See Also:
-
log
Log a message.- Parameters:
s- message to log- Since:
- 12826
-
log
Log an exception.- Parameters:
e- exception to logs- message prefix- Since:
- 12826
-
getLog
Returns the log.- Returns:
- the log
- Since:
- 12826
-
resetLog
Resets the log.- Since:
- 12826
-
replacePreferences
-
appendPreferences
-
deletePreferenceValues
Delete items frommainprefcollections that match items fromfragmentcollections.- Parameters:
fragment- preferencesmainpref- main preferences
-
deletePreferenceKeyByPattern
-
deletePreferenceKey
-
getList
-
getListOfLists
private static List<List<String>> getListOfLists(Preferences mainpref, String key, boolean warnUnknownDefault) -
getListOfStructs
private static List<Map<String,String>> getListOfStructs(Preferences mainpref, String key, boolean warnUnknownDefault) -
defaultUnknownWarning
-
showPrefs
-
getBoolean
Gets an boolean that may be specialized- Parameters:
prefs- the preferenceskey- The basic keyspecName- The sub-key to append to the keydef- The default value- Returns:
- The boolean value or the default value if it could not be parsed
- Since:
- 12891
-
getInteger
Gets an integer that may be specialized- Parameters:
prefs- the preferenceskey- The basic keyspecName- The sub-key to append to the keydef- The default value- Returns:
- The integer value or the default value if it could not be parsed
- Since:
- 12891
-
removeFromList
Removes a value from a given String list- Parameters:
prefs- the preferenceskey- The preference key the list is stored withvalue- The value that should be removed in the list- Since:
- 12894
-
putListBounded
Saves at mostmaxsizeitems of listval.- Parameters:
prefs- the preferenceskey- keymaxsize- max number of items to saveval- value- Returns:
true, if something has changed (i.e. value is different than before)- Since:
- 12894
-