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

Last change on this file since 10824 was 10824, checked in by Don-vip, 8 years ago

see #13309 - Caching and notifying preferences (patch by michael2402) - gsoc-core

  • Property svn:eol-style set to native
File size: 927 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 getPreferences().getCollection(getKey(), getDefaultValue());
28 }
29
30 @Override
31 public boolean put(Collection<String> value) {
32 return getPreferences().putCollection(getKey(), value);
33 }
34}
Note: See TracBrowser for help on using the repository browser.