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

Last change on this file since 9689 was 9689, checked in by bastiK, 8 years ago

applied #12454 - set default values of preferences on construct (patch by kolesar)

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