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

org.spincast.plugins.jacksonjson.SpincastJacksonJsonPluginModule Maven / Gradle / Ivy

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

import org.spincast.core.exchange.RequestContext;
import org.spincast.core.guice.SpincastGuiceModuleBase;
import org.spincast.core.json.JsonManager;
import org.spincast.core.json.JsonPathUtils;
import org.spincast.core.json.JsonPathUtilsDefault;
import org.spincast.core.websocket.WebsocketContext;

import com.google.inject.Scopes;
import com.google.inject.multibindings.Multibinder;

public class SpincastJacksonJsonPluginModule extends SpincastGuiceModuleBase {

    public SpincastJacksonJsonPluginModule() {
        super();
    }

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

    @Override
    protected void configure() {

        bindJsonManager();
        bindJsonPathUtils();
        bindJsonMixinsMultiBinder();
    }

    protected void bindJsonManager() {
        bind(JsonManager.class).to(getSpincastJsonManager()).in(Scopes.SINGLETON);
    }

    protected Class getSpincastJsonManager() {
        return SpincastJsonManager.class;
    }

    protected void bindJsonPathUtils() {
        bind(JsonPathUtils.class).to(getJsonPathUtilsImplClass()).in(Scopes.SINGLETON);
    }

    protected Class getJsonPathUtilsImplClass() {
        return JsonPathUtilsDefault.class;
    }

    protected void bindJsonMixinsMultiBinder() {

        //==========================================
        // Create the Json mixin info multibinder so it's not null,
        // even if no mixin infos are added.
        //==========================================
        @SuppressWarnings("unused")
        Multibinder uriBinder = Multibinder.newSetBinder(binder(), JsonMixinInfo.class);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy