Class FactoryModule

    • Constructor Summary

      Constructors 
      Constructor Description
      FactoryModule()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void factory​(Class<?> factory)
      Register an assisted injection factory.
      • Methods inherited from class com.google.inject.AbstractModule

        addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindListener, bindScope, configure, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding
    • Constructor Detail

      • FactoryModule

        public FactoryModule()
    • Method Detail

      • factory

        protected void factory​(Class<?> factory)
        Register an assisted injection factory.

        This function provides an automatic way to define a factory that creates a concrete type through assisted injection. For example to configure the following assisted injection case:

         public class Foo {
           public interface Factory {
             Foo create(int a);
           }
           @Inject
           Foo(Logger log, @Assisted int a) {...}
         }
         
        Just pass Foo.Factory.class to this method. The factory will be generated to return its one return type as declared in the creation method.
        Parameters:
        factory - interface which specifies the bean factory method.