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

org.spincast.plugins.request.SpincastRequestPluginModule Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
package org.spincast.plugins.request;

import org.spincast.core.dictionary.DictionaryEntries;
import org.spincast.core.exchange.RequestContext;
import org.spincast.core.exchange.RequestRequestContextAddon;
import org.spincast.core.guice.SpincastGuiceModuleBase;
import org.spincast.core.guice.SpincastGuiceScopes;
import org.spincast.core.websocket.WebsocketContext;

import com.google.inject.multibindings.Multibinder;

/**
 * Guice module for the Spincast Request plugin.
 */
public class SpincastRequestPluginModule extends SpincastGuiceModuleBase {

    public SpincastRequestPluginModule() {
        super();
    }

    public SpincastRequestPluginModule(Class> requestContextImplementationClass,
                                       Class> websocketContextImplementationClass) {
        super(requestContextImplementationClass, websocketContextImplementationClass);
    }

    @Override
    protected void configure() {
        bindRequestContextAddon();

        //==========================================
        // Example of a plugin providing messages
        // for the Dictionary.
        //
        // To be added as eager singletons!
        //==========================================
        Multibinder dictionaryMultibinder = Multibinder.newSetBinder(binder(), DictionaryEntries.class);
        dictionaryMultibinder.addBinding().to(SpincastRequestPluginDictionaryEntries.class).asEagerSingleton();
    }

    protected void bindRequestContextAddon() {

        bind(parameterizeWithRequestContext(RequestRequestContextAddon.class)).to(parameterizeWithContextInterfaces(SpincastRequestRequestContextAddon.class))
                                                                              .in(SpincastGuiceScopes.REQUEST);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy