@@ -0,0 +1,1576 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.%0Apackage com.yahoo.vespa.config.server.modelfactory;%0A%0Aimport com.yahoo.config.application.api.ApplicationPackage;%0Aimport com.yahoo.vespa.flags.Flags;%0Aimport com.yahoo.vespa.flags.FlagSource;%0Aimport com.yahoo.vespa.flags.InMemoryFlagSource;%0Aimport com.yahoo.vespa.flags.OrderedFlagSource;%0A%0Aimport java.util.Map;%0A%0A%0A/**%0A * @author arnej%0A */%0Apublic class LegacyFlags %7B%0A%0A    public static final String GEO_POSITIONS = %22geo-positions%22;%0A    public static final String FOO_BAR = %22foo-bar%22; // for testing%0A%0A    private static FlagSource buildFrom(Map%3CString, String%3E legacyOverrides) %7B%0A        var flags = new InMemoryFlagSource();%0A        for (var entry : legacyOverrides.entrySet()) %7B%0A            String key = entry.getKey();%0A            String value = entry.getValue();%0A            boolean legacyWanted = Boolean.valueOf(value);%0A            switch (key) %7B%0A            case GEO_POSITIONS:%0A                flags = flags.withBooleanFlag(Flags.USE_V8_GEO_POSITIONS.id(), ! legacyWanted);%0A                break;%0A            case FOO_BAR:%0A                // ignored%0A                break;%0A            default:%0A                throw new IllegalArgumentException(%22Unknown legacy override: %22+key);%0A            %7D%0A        %7D%0A        return flags;%0A    %7D%0A%0A    public static FlagSource from(ApplicationPackage pkg, FlagSource input) %7B%0A        var overrides = buildFrom(pkg.legacyOverrides());%0A        FlagSource result = new OrderedFlagSource(overrides, input);%0A        return result;%0A    %7D%0A%7D%0A

convert map to FlagSource with overrides