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