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

i.InternedClasses Maven / Gradle / Ivy

There is a newer version: 0.9.6
Show newest version
package i;

import java.util.IdentityHashMap;


/**
 * Really just a high-level wrapper over an IdentityHashMap to contain real classes to shadow classes.
 * This exists because some of the logic was duplicated in a few places.
 */
public class InternedClasses {
    private final IdentityHashMap, s.java.lang.Class> internedClassWrappers;

    public InternedClasses() {
        this.internedClassWrappers = new IdentityHashMap<>();
    }

    public InternedClasses(InternedClasses src) {
        this.internedClassWrappers = new IdentityHashMap<>(src.internedClassWrappers);
    }

    public  s.java.lang.Class get(Class underlyingClass) {
        s.java.lang.Class internedClass = this.internedClassWrappers.get(underlyingClass);
        if (null == internedClass) {
            internedClass = new s.java.lang.Class<>(underlyingClass);
            this.internedClassWrappers.put(underlyingClass, internedClass);
        }
        return (s.java.lang.Class)internedClass;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy