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 Enum} value. 008 * 009 * @author András Kolesár 010 * @param <T> the {@code Enum} class 011 */ 012public class EnumProperty<T extends Enum<T>> extends ParametrizedEnumProperty<T> { 013 014 protected final String key; 015 016 /** 017 * Constructs a new {@code EnumProperty}. 018 * @param key The property key 019 * @param enumClass The {@code Enum} class 020 * @param defaultValue The default value 021 */ 022 public EnumProperty(String key, Class<T> enumClass, T defaultValue) { 023 super(enumClass, defaultValue); 024 this.key = key; 025 if (Main.pref != null) { 026 get(); 027 } 028 } 029 030 @Override 031 protected String getKey(String... params) { 032 return key; 033 } 034}