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

org.analogweb.guice.GuiceContainerAdaptorFactory Maven / Gradle / Ivy

There is a newer version: 0.10.1
Show newest version
package org.analogweb.guice;

import org.analogweb.ApplicationContext;
import org.analogweb.ContainerAdaptorFactory;
import org.analogweb.util.Assertion;

import com.google.inject.Injector;

/**
 * {@link GuiceContainerAdaptor}のインスタンスを生成するファクトリです。
 * @author snowgoose
 */
public class GuiceContainerAdaptorFactory implements ContainerAdaptorFactory {

    @Override
    public GuiceContainerAdaptor createContainerAdaptor(ApplicationContext context) {
        Assertion.notNull(context, ApplicationContext.class.getName());
        Injector injector = context.getAttribute(Injector.class, Injector.class.getName());
        if (injector == null) {
            return null;
        }
        return new GuiceContainerAdaptor(injector);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy