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

org.sagacity.sqltoy.solon.integration.SolonAppContext Maven / Gradle / Ivy

There is a newer version: 5.6.23.RC3.jre8
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy