All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.deephacks.tools4j.config.internal.core.runtime.typesafe.impl.ResolveMemos Maven / Gradle / Ivy

There is a newer version: 0.15.0
Show newest version
package org.deephacks.tools4j.config.internal.core.runtime.typesafe.impl;

import java.util.HashMap;
import java.util.Map;

/**
 * This exists because we have to memoize resolved substitutions as we go
 * through the typesafe tree; otherwise we could end up creating multiple copies
 * of values or whole trees of values as we follow chains of substitutions.
 */
final class ResolveMemos {
    // note that we can resolve things to undefined (represented as Java null,
    // rather than ConfigNull) so this map can have null values.
    final private Map memos;

    ResolveMemos() {
        this.memos = new HashMap();
    }

    AbstractConfigValue get(MemoKey key) {
        return memos.get(key);
    }

    void put(MemoKey key, AbstractConfigValue value) {
        memos.put(key, value);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy