ConcurrentHashMap<Class, Help> cache = new ConcurrentHashMap<Class,Help>();
public <T> Help getImp(Class<T> type){
Help cached = cache.get(type);
if (cached==null){
if (type == SmallAssist.class){
FoodAndMedicine helpImpl = new FoodAndMedicine();
Help proxy = (Help) Proxy.newProxyInstance(type.getClassLoader(), new Class[]{Help.class}, helpImpl);
cache.put(type, proxy);
return proxy;
}else {
HelpDefault help1 = new HelpDefault();
Help proxy = (Help) Proxy.newProxyInstance(type.getClassLoader(), new Class[]{Help.class}, help1);
cache.put(type, proxy);
return proxy;
}
}else{
return cached;
}
}