001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.gui.mappaint;
003
004import org.openstreetmap.josm.gui.mappaint.StyleSetting.BooleanStyleSetting;
005
006/**
007 * Factory to create matching {@link StyleSettingGui} instances for given
008 * {@link StyleSetting} objects.
009 * @since 12831
010 */
011public final class StyleSettingGuiFactory {
012
013    private StyleSettingGuiFactory() {
014        // hide constructor
015    }
016
017    /**
018     * Create a matching {@link StyleSettingGui} instances for a given
019     * {@link StyleSetting} object.
020     * @param setting the {@code StyleSetting} object
021     * @return matching {@code StyleSettingGui}
022     * @throws UnsupportedOperationException when class of {@link StyleSetting}
023     * is not supported
024     */
025    public static StyleSettingGui getStyleSettingGui(StyleSetting setting) {
026        if (setting instanceof BooleanStyleSetting) {
027            return new BooleanStyleSettingGui((BooleanStyleSetting) setting);
028        }
029        throw new UnsupportedOperationException("class " + setting.getClass() + " not supported");
030    }
031
032}