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

public.javadoc.org.spincast.core.guice.GuiceTweaker.html Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version






GuiceTweaker (org.spincast:spincast-framework 1.13.0 API)












org.spincast.core.guice

Class GuiceTweaker

  • All Implemented Interfaces:
    SpincastContextTypesInterested, SpincastPlugin


    public class GuiceTweaker
    extends Object
    implements SpincastPlugin
    Spincast plugin made available through a ThreadLocal.

    This allows the tweaking of the Guice context of an application without touching its bootstrapping code.

    The first use case for this is to be able to mock some parts of an application in order to test it.

    It is the responsibility of the code creating the GuiceTweaker to make sure the ThreadLocal variable is removed.

    • Constructor Detail

      • GuiceTweaker

        public GuiceTweaker()
    • Method Detail

      • getOverridingModules

        protected Set<com.google.inject.Module> getOverridingModules()
      • getExactBindingsToRemoveBeforePlugins

        protected Set<com.google.inject.Key<?>> getExactBindingsToRemoveBeforePlugins()
      • getBindingsHierarchiesToRemoveBeforePlugins

        public Set<Class<?>> getBindingsHierarchiesToRemoveBeforePlugins()
      • isDisableBindCurrentClass

        public boolean isDisableBindCurrentClass()
      • createdGuiceInjector

        public void createdGuiceInjector(com.google.inject.Injector injector)
        Description copied from interface: SpincastPlugin
        Once all the plugins have been applied, this method is called with the resulting Guice injector.
        Specified by:
        createdGuiceInjector in interface SpincastPlugin
      • getInjector

        public com.google.inject.Injector getInjector()
      • beforePlugins

        public com.google.inject.Module beforePlugins(com.google.inject.Module combinedModule)
        Ran before the plugins are applied in SpincastBootstrapper.
        Parameters:
        combinedModule - the combinaison of all the Guice modules just before the plugins are applied.
      • apply

        public com.google.inject.Module apply(com.google.inject.Module currentModule)
        Ran as a regular plugin.
        Specified by:
        apply in interface SpincastPlugin
        Returns:
        an ajusted Guice module.
      • afterPlugins

        public com.google.inject.Module afterPlugins(com.google.inject.Module combinedModule)
        Ran after the plugins are applied in SpincastBootstrapper.
        Parameters:
        combinedModule - the combinaison of all the Guice modules just after the plugins have been applied.
      • addOverridingModules

        protected com.google.inject.Module addOverridingModules(com.google.inject.Module combinedModule)
        Those overriding modules will be added both *before* and then, again, *after* the plugins are applied.
      • getPluginsToDisable

        public Set<String> getPluginsToDisable()
        Description copied from interface: SpincastPlugin
        If required, the ids of plugins that shouldn't be installed.

        This plugin is repsonsible to bind any components that won't be bound because it marks some plugins as "to be ignored".

        Specified by:
        getPluginsToDisable in interface SpincastPlugin
      • getRequestContextImplementationClass

        protected Class<? extends RequestContext<?>> getRequestContextImplementationClass()
      • getWebsocketContextImplementationClass

        protected Class<? extends WebsocketContext<?>> getWebsocketContextImplementationClass()
      • overridingModule

        public void overridingModule(com.google.inject.Module overridingModule)
        Adds an overriding Module. The bindings of this Module will be applied before the plugins run in SpincastBootstrapper.
      • exactBindingToRemove

        public void exactBindingToRemove(com.google.inject.Key<?> key)
        An exact binding to remove from the combined modules. This will be done before the plugins run in SpincastBootstrapper.
      • bindingHierarchyToRemove

        public void bindingHierarchyToRemove(Class<?> parentClass)
        An binding hierarchy to remove from the combined modules. All bindings implementing or extending the specified parent class, directly or indirectly, will be removed. This will be done before the plugins run in SpincastBootstrapper.
      • plugin

        public void plugin(SpincastPlugin plugin)
        Adds an extra plugin to be applied when the Guice context is created.
      • disableBindCurrentClass

        public void disableBindCurrentClass()
      • pluginToDisable

        public void pluginToDisable(String pluginId)

Copyright © 2019. All rights reserved.





© 2015 - 2024 Weber Informatics LLC | Privacy Policy