Changeset 14122 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2018-08-11T18:18:58+02:00 (6 years ago)
Author:
Don-vip
Message:

see #15229 - minor preferences refactoring

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r14119 r14122  
    693693    }
    694694
    695     /**
    696      * Gets a map of all settings that are currently stored
    697      * @return The settings
    698      */
     695    @Override
    699696    public Map<String, Setting<?>> getAllSettings() {
    700697        return new TreeMap<>(settingsMap);
  • trunk/src/org/openstreetmap/josm/spi/preferences/AbstractPreferences.java

    r12881 r14122  
    124124
    125125    /**
     126     * Gets a map of all settings that are currently stored
     127     * @return The settings
     128     */
     129    public abstract Map<String, Setting<?>> getAllSettings();
     130
     131    /**
    126132     * Set a value for a certain setting. The changed setting is saved to the preference file immediately.
    127133     * Due to caching mechanisms on modern operating systems and hardware, this shouldn't be a performance problem.
  • trunk/src/org/openstreetmap/josm/spi/preferences/MemoryPreferences.java

    r12987 r14122  
    77import java.util.Objects;
    88import java.util.Set;
     9import java.util.TreeMap;
    910
    1011/**
     
    2223    @Override
    2324    public boolean putSetting(String key, Setting<?> setting) {
    24         Setting current = settings.get(key);
     25        Setting<?> current = settings.get(key);
    2526        if (setting == null) {
    2627            settings.remove(key);
     
    3334    @Override
    3435    public <T extends Setting<?>> T getSetting(String key, T def, Class<T> klass) {
    35         Setting current = settings.get(key);
     36        Setting<?> current = settings.get(key);
    3637        if (current != null && klass.isInstance(current)) {
    3738            @SuppressWarnings("unchecked")
     
    4546    public Set<String> getKeySet() {
    4647        return Collections.unmodifiableSet(settings.keySet());
     48    }
     49
     50    @Override
     51    public Map<String, Setting<?>> getAllSettings() {
     52        return new TreeMap<>(settings);
    4753    }
    4854
     
    6672        // do nothing
    6773    }
    68 
    6974}
Note: See TracChangeset for help on using the changeset viewer.