class KeyedProperties extends ConcurrentSkipListMap<String,Object> {
    private static final long serialVersionUID = 2L;
    
    private static final Logger logger = Logger.getLogger(KeyedProperties.class.getName());

    /** the alternate global property-paths leading to this map 
     * TODO: consider if deterministic ordered list is important */
    protected TreeSet<String> externalPaths = new TreeSet<String>(); 
    
    /**
     * Add a path by which the outside world can reach this map
     * @param path String path
     */
    public void addExternalPath(String path) {
        externalPaths.add(path);
    }

    /**
     * Get the given value, checking override maps if appropriate.
     * 
     * @param key
     * @return discovered override, or local value
     */
    public Object get(String key) {
        ArrayList<OverlayContext> overlays = threadOverrides.get();
        for(int i = overlays.size()-1; i>=0; i--) {
            OverlayContext ocontext = overlays.get(i); 
            for(int j = ocontext.getOverlayNames().size()-1; j>=0; j--) {
                String name = ocontext.getOverlayNames().get(j);
                Map<String,Object> m = ocontext.getOverlayMap(name);
                if (m != null) { 
                    for(String ok : getOverrideKeys(key)) {
                        Object val = m.get(ok);
                        if(val!=null) {
                            return val;
                        }
                    }
                } else {
                    logger.warning("sheet '" + name + "' should apply but there is no such sheet!");
                }
            }
        }

        return super.get(key);
    }

    /**
     * Compose the complete keys (externalPath + local key name) to use
     * for checking for contextual overrides. 
     * 
     * @param key local key to compose
     * @return List of full keys to check
     */
    protected List<String> getOverrideKeys(String key) {
        ArrayList<String> keys = new ArrayList<String>(externalPaths.size());
        for(String path : externalPaths) {
            keys.add(path+"."+key);
        }
        return keys;
    }

    
    //
    // CLASS SERVICES
    //
    
    /**
     * ThreadLocal (contextual) collection of pushed override maps
     */
    protected static ThreadLocal<ArrayList<OverlayContext>> threadOverrides = 
        new ThreadLocal<ArrayList<OverlayContext>>() {
        protected ArrayList<OverlayContext> initialValue() {
            return new ArrayList<OverlayContext>();
        }
    };
    /**
     * Add an override map to the stack 
     */
    static public void pushOverrideContext(OverlayContext ocontext) {
        threadOverrides.get().add(ocontext);
    }
    
    /**
     * Remove last-added override map from the stack
     * @return Map removed
     */
    static public OverlayContext popOverridesContext() {
        // TODO maybe check that pop is as expected
        return threadOverrides.get().remove(threadOverrides.get().size()-1);
    }
    
    static public void clearAllOverrideContexts() {
        threadOverrides.get().clear(); 
    }
    
    static public void loadOverridesFrom(OverlayContext ocontext) {
        assert ocontext.haveOverlayNamesBeenSet();
        pushOverrideContext(ocontext);
    }
    
    static public boolean clearOverridesFrom(OverlayContext ocontext) {
        return threadOverrides.get().remove(ocontext);
    }
    
    static public void withOverridesDo(OverlayContext ocontext, Runnable todo) {<FILL_FUNCTION_BODY>}

    public static boolean overridesActiveFrom(OverlayContext ocontext) {
        return threadOverrides.get().contains(ocontext);
    }
}

        try {
            loadOverridesFrom(ocontext);
            todo.run();
        } finally {
            clearOverridesFrom(ocontext); 
        }
    
<methods>public void <init>() ,public void <init>(Comparator<? super java.lang.String>) ,public void <init>(Map<? extends java.lang.String,? extends java.lang.Object>) ,public void <init>(SortedMap<java.lang.String,? extends java.lang.Object>) ,public Entry<java.lang.String,java.lang.Object> ceilingEntry(java.lang.String) ,public java.lang.String ceilingKey(java.lang.String) ,public void clear() ,public ConcurrentSkipListMap<java.lang.String,java.lang.Object> clone() ,public Comparator<? super java.lang.String> comparator() ,public java.lang.Object compute(java.lang.String, BiFunction<? super java.lang.String,? super java.lang.Object,? extends java.lang.Object>) ,public java.lang.Object computeIfAbsent(java.lang.String, Function<? super java.lang.String,? extends java.lang.Object>) ,public java.lang.Object computeIfPresent(java.lang.String, BiFunction<? super java.lang.String,? super java.lang.Object,? extends java.lang.Object>) ,public boolean containsKey(java.lang.Object) ,public boolean containsValue(java.lang.Object) ,public NavigableSet<java.lang.String> descendingKeySet() ,public ConcurrentNavigableMap<java.lang.String,java.lang.Object> descendingMap() ,public Set<Entry<java.lang.String,java.lang.Object>> entrySet() ,public boolean equals(java.lang.Object) ,public Entry<java.lang.String,java.lang.Object> firstEntry() ,public java.lang.String firstKey() ,public Entry<java.lang.String,java.lang.Object> floorEntry(java.lang.String) ,public java.lang.String floorKey(java.lang.String) ,public void forEach(BiConsumer<? super java.lang.String,? super java.lang.Object>) ,public java.lang.Object get(java.lang.Object) ,public java.lang.Object getOrDefault(java.lang.Object, java.lang.Object) ,public ConcurrentNavigableMap<java.lang.String,java.lang.Object> headMap(java.lang.String) ,public ConcurrentNavigableMap<java.lang.String,java.lang.Object> headMap(java.lang.String, boolean) ,public Entry<java.lang.String,java.lang.Object> higherEntry(java.lang.String) ,public java.lang.String higherKey(java.lang.String) ,public boolean isEmpty() ,public NavigableSet<java.lang.String> keySet() ,public Entry<java.lang.String,java.lang.Object> lastEntry() ,public java.lang.String lastKey() ,public Entry<java.lang.String,java.lang.Object> lowerEntry(java.lang.String) ,public java.lang.String lowerKey(java.lang.String) ,public java.lang.Object merge(java.lang.String, java.lang.Object, BiFunction<? super java.lang.Object,? super java.lang.Object,? extends java.lang.Object>) ,public NavigableSet<java.lang.String> navigableKeySet() ,public Entry<java.lang.String,java.lang.Object> pollFirstEntry() ,public Entry<java.lang.String,java.lang.Object> pollLastEntry() ,public java.lang.Object put(java.lang.String, java.lang.Object) ,public java.lang.Object putIfAbsent(java.lang.String, java.lang.Object) ,public java.lang.Object remove(java.lang.Object) ,public boolean remove(java.lang.Object, java.lang.Object) ,public java.lang.Object replace(java.lang.String, java.lang.Object) ,public boolean replace(java.lang.String, java.lang.Object, java.lang.Object) ,public void replaceAll(BiFunction<? super java.lang.String,? super java.lang.Object,? extends java.lang.Object>) ,public int size() ,public ConcurrentNavigableMap<java.lang.String,java.lang.Object> subMap(java.lang.String, java.lang.String) ,public ConcurrentNavigableMap<java.lang.String,java.lang.Object> subMap(java.lang.String, boolean, java.lang.String, boolean) ,public ConcurrentNavigableMap<java.lang.String,java.lang.Object> tailMap(java.lang.String) ,public ConcurrentNavigableMap<java.lang.String,java.lang.Object> tailMap(java.lang.String, boolean) ,public Collection<java.lang.Object> values() <variables>private static final java.lang.invoke.VarHandle ADDER,private static final int EQ,private static final int GT,private static final java.lang.invoke.VarHandle HEAD,private static final int LT,private static final java.lang.invoke.VarHandle NEXT,private static final java.lang.invoke.VarHandle RIGHT,private static final java.lang.invoke.VarHandle VAL,private transient java.util.concurrent.atomic.LongAdder adder,final Comparator<? super java.lang.String> comparator,private transient SubMap<java.lang.String,java.lang.Object> descendingMap,private transient EntrySet<java.lang.String,java.lang.Object> entrySet,private transient Index<java.lang.String,java.lang.Object> head,private transient KeySet<java.lang.String,java.lang.Object> keySet,private static final long serialVersionUID,private transient Values<java.lang.String,java.lang.Object> values