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

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

see #15229 - remove some uses of Main.pref

  • Property svn:eol-style set to native
File size: 999 bytes
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
7/**
8 * A property containing a {@code Collection} of {@code String} as value.
9 * @deprecated use {@link ListProperty}
10 */
11@Deprecated
12public class CollectionProperty extends AbstractProperty<Collection<String>> {
13
14    /**
15     * Constructs a new {@code CollectionProperty}.
16     * @param key The property key
17     * @param defaultValue The default value
18     */
19    public CollectionProperty(String key, Collection<String> defaultValue) {
20        super(key, defaultValue);
21        if (getPreferences() != null) {
22            get();
23        }
24    }
25
26    @Override
27    public Collection<String> get() {
28        return getPreferences().getList(getKey(), new ArrayList<>(getDefaultValue()));
29    }
30
31    @Override
32    public boolean put(Collection<String> value) {
33        return getPreferences().putList(getKey(), new ArrayList<>(value));
34    }
35}
Note: See TracBrowser for help on using the repository browser.