source: josm/trunk/src/org/openstreetmap/josm/data/preferences/CollectionProperty.java @ 12999

Last change on this file since 12999 was 12999, checked in by bastiK, 17 months ago

see #15229 - use Config.getPref() in *Property classes

  • Property svn:eol-style set to native
File size: 1.0 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.preferences;
3
4import java.util.ArrayList;
5import java.util.Collection;
6
7import org.openstreetmap.josm.Main;
8
9/**
10 * A property containing a {@code Collection} of {@code String} as value.
11 * @deprecated use {@link ListProperty}
12 */
13@Deprecated
14public class CollectionProperty extends AbstractProperty<Collection<String>> {
15
16    /**
17     * Constructs a new {@code CollectionProperty}.
18     * @param key The property key
19     * @param defaultValue The default value
20     */
21    public CollectionProperty(String key, Collection<String> defaultValue) {
22        super(key, defaultValue);
23        if (Main.pref != null) {
24            get();
25        }
26    }
27
28    @Override
29    public Collection<String> get() {
30        return getPreferences().getList(getKey(), new ArrayList<>(getDefaultValue()));
31    }
32
33    @Override
34    public boolean put(Collection<String> value) {
35        return getPreferences().putList(getKey(), new ArrayList<>(value));
36    }
37}
Note: See TracBrowser for help on using the repository browser.