Class FactoryModule

java.lang.Object
com.google.inject.AbstractModule
com.google.gerrit.extensions.config.FactoryModule
All Implemented Interfaces:
com.google.inject.Module
Direct Known Subclasses:
AccessControlModule, ApprovalModule, CacheModule, CmdLineParserModule, DefaultSubmitRule.DefaultSubmitRuleModule, EmailModule, GerritRequestModule, GitModule, GroupDbModule, GroupModule, HttpdModule, com.google.gerrit.lifecycle.LifecycleModule, NoteDbDraftCommentsModule, NoteDbModule, NoteDbStarredChangesModule, RepoSequence.RepoSequenceModule, RestApiModule, RestModule

public abstract class FactoryModule extends com.google.inject.AbstractModule
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    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, requestInjection, requestStaticInjection, requireBinding, requireBinding

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • FactoryModule

      public FactoryModule()
  • Method Details

    • 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.