001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.data.preferences;
003
004import org.openstreetmap.josm.Main;
005
006/**
007 * A property containing an {@code String} value.
008 */
009public class StringProperty extends AbstractProperty<String> {
010
011    /**
012     * Constructs a new {@code StringProperty}.
013     * @param key The property key
014     * @param defaultValue The default value
015     */
016    public StringProperty(String key, String defaultValue) {
017        super(key, defaultValue);
018        if (Main.pref != null) {
019            get();
020        }
021    }
022
023    @Override
024    public String get() {
025        return Main.pref.get(getKey(), getDefaultValue());
026    }
027
028    @Override
029    public boolean put(String value) {
030        return Main.pref.put(getKey(), value);
031    }
032}