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