public abstract class FactoryModule
extends com.google.inject.AbstractModule
Constructor and Description |
---|
FactoryModule() |
Modifier and Type | Method and Description |
---|---|
protected void |
factory(Class<?> factory)
Register an assisted injection factory.
|
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
protected void factory(Class<?> 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.factory
- interface which specifies the bean factory method.