source: josm/trunk/src/org/openstreetmap/josm/data/preferences/ListProperty.java@ 12911

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