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

com.github.yulichang.toolkit.MPJTableMapperHelper Maven / Gradle / Ivy

There is a newer version: 1.5.2
Show newest version
package com.github.yulichang.toolkit;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 实体类对应的mapper管理
 *
 * @author yulichang
 * @since 1.2.0
 */
public class MPJTableMapperHelper {

    private static final Map, Class> CACHE = new ConcurrentHashMap<>();
    private static final Map, Class> CACHE_REVERSE = new ConcurrentHashMap<>();


    public static void init(Class clazz, Class mapper) {
        if (clazz != null && mapper != null) {
            CACHE.put(clazz, mapper);
            CACHE_REVERSE.put(mapper, clazz);
        }
    }

    public static Class getMapper(Class clazz) {
        return CACHE.get(clazz);
    }

    public static Class getEntity(Class clazz) {
        return CACHE_REVERSE.get(clazz);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy