org.sagacity.sqltoy.solon.integration.SolonAppContext Maven / Gradle / Ivy
package org.sagacity.sqltoy.solon.integration;
import java.util.HashMap;
import java.util.Map;
import org.noear.solon.core.AppContext;
public class SolonAppContext implements org.sagacity.sqltoy.integration.AppContext {
AppContext context;
public SolonAppContext(AppContext context) {
this.context = context;
}
@Override
public boolean containsBean(String s) {
return context.hasWrap(s);
}
@Override
public Object getBean(String s) {
return context.getBean(s);
}
@Override
public T getBean(Class aClass) {
return context.getBean(aClass);
}
@Override
public Map getBeansOfType(Class aClass) {
Map beans = new HashMap<>();
context.beanForeach(beanWrap -> {
if (aClass.isInstance(beanWrap.get())) {
beans.put(beanWrap.name(), beanWrap.get());
}
});
return beans;
}
}