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

org.jtwig.reflection.model.java.JavaClassManager Maven / Gradle / Ivy

There is a newer version: 5.87.0.RELEASE
Show newest version
package org.jtwig.reflection.model.java;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

public class JavaClassManager {
    private static JavaClassManager INSTANCE = new JavaClassManager(new JavaClassFactory(), new ConcurrentHashMap());

    public static JavaClassManager classManager () {
        return INSTANCE;
    }

    private final JavaClassFactory javaClassFactory;
    private final ConcurrentMap javaClassMap;

    public JavaClassManager(JavaClassFactory javaClassFactory, ConcurrentMap javaClassMap) {
        this.javaClassFactory = javaClassFactory;
        this.javaClassMap = javaClassMap;
    }

    public JavaClass metadata (Class type) {
        if (!javaClassMap.containsKey(type)) {
            javaClassMap.put(type, javaClassFactory.create(type));
        }
        return javaClassMap.get(type);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy