public final class DaggerAdapter extends Object
@dagger.Module
such that their @dagger.Provides
methods can be properly invoked by Guice to perform their provision operations.
Simple example:
Guice.createInjector(
DaggerAdapter.from(SomeDaggerModule.class, new AnotherModuleWithConstructor());
For modules with no instance binding methods, prefer using a class literal. If there are instance binding methods, an instance of the module must be passed.
Any class literals specified by dagger.Module(includes = ...)
transitively will be
included. Modules are de-duplicated, though multiple module instances of the same type is an
error. Specifying a module instance and a class literal is also an error.
Some notes on usage and compatibility.
@Singleton
for all scopes, including shorter-lived scopes like
per-request or per-activity. Using modules written with Dagger 1.x usage in mind may result
in mis-scoped objects.
Modifier and Type | Method and Description |
---|---|
static Module |
from(Object... daggerModuleObjects)
Creates a new
DaggerAdapter from daggerModuleObjects . |
public static Module from(Object... daggerModuleObjects)
DaggerAdapter
from daggerModuleObjects
.Copyright © 2006–2020 Google, Inc.. All rights reserved.