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

Last change on this file since 12840 was 12840, checked in by bastiK, 7 years ago

see #15229 - extract interface for Preferences class

some changes to the method names and signatures

  • to be more in line with java.util.prefs.Preferences:
    put(String, boolean) -> putBoolean(String, boolean)
    getInteger(String) -> getInt(String)
    putInteger(String, Integer) -> putInt(String, int)
    putDouble(String, Double) -> putDouble(String, double)
    
  • for internal consistency with Setting classes:
    getCollection -> getList
    putCollection -> putList
    getArray -> getListOfLists
    putArray -> putListOfLists
    getListOfStructs -> getListOfMaps
    putListOfStructs -> putListOfMaps
    
  • Property svn:eol-style set to native
File size: 979 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 * @deprecated use {@link ListProperty}
11 */
12@Deprecated
13public class CollectionProperty extends AbstractProperty<Collection<String>> {
14
15 /**
16 * Constructs a new {@code CollectionProperty}.
17 * @param key The property key
18 * @param defaultValue The default value
19 */
20 public CollectionProperty(String key, Collection<String> defaultValue) {
21 super(key, defaultValue);
22 if (Main.pref != null) {
23 get();
24 }
25 }
26
27 @Override
28 public Collection<String> get() {
29 return getPreferences().getCollection(getKey(), getDefaultValue());
30 }
31
32 @Override
33 public boolean put(Collection<String> value) {
34 return getPreferences().putCollection(getKey(), value);
35 }
36}
Note: See TracBrowser for help on using the repository browser.