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