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

com.atom.annotation.bean.ApiImpls Maven / Gradle / Ivy

There is a newer version: 5.0.0
Show newest version
package com.atom.annotation.bean;

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


public abstract class ApiImpls {

    private final Map, ApiImplsMap> mApiImpsMap = new HashMap<>();

    public ApiImpls() {
    }

    protected  void add(String name, Class apiClass, Class implClass, long version) {
        ApiImplsMap implsMap;
        synchronized (mApiImpsMap) {
            ApiImplsMap apiImplsMap = mApiImpsMap.get(apiClass);
            if (apiImplsMap == null) {
                implsMap = new ApiImplsMap<>();
                mApiImpsMap.put(apiClass, implsMap);
            } else {
                implsMap = (ApiImplsMap) apiImplsMap;
            }
        }
        implsMap.put(implClass, new ApiImplWrapper(apiClass, implClass, name, version));
    }

    @SuppressWarnings("unchecked")
    public  Map, ApiImplWrapper> getApiImpls(Class apiClass) {
        synchronized (mApiImpsMap) {
            return (ApiImplsMap) mApiImpsMap.get(apiClass);
        }
    }

    private static class ApiImplsMap extends HashMap, ApiImplWrapper> {

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy