Migrate @Provides methods to @Binds methods where possible.

@Binds is a much more efficient way to delegate one binding to another in that:
  * The @Binds method does not need to be invoked
  * It does not generate an additional Provider implementation
  * An additional Provider does does not need to be instantiated
Future changes to Dagger's component processor will add even further benefits.

More information: []

ATTENTION REVIEWERS: This migration is being done with global approval.  Per-project approval is not required.

Tested:
    TAP train for global presubmit queue
    []
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=125980758
This commit is contained in:
gak 2016-06-27 11:47:54 -07:00 committed by Ben McIlwain
parent a4091594d0
commit a47cc2a85c
5 changed files with 20 additions and 26 deletions

View file

@ -14,6 +14,7 @@
package google.registry.tools;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
@ -24,17 +25,15 @@ import java.util.Random;
/** Dagger module for Registry Tool. */
@Module
final class RegistryToolModule {
abstract class RegistryToolModule {
@Provides
static RegistryToolEnvironment provideRegistryToolEnvironment() {
return RegistryToolEnvironment.get();
}
@Provides
static PasswordGenerator providePasswordGenerator(RandomPasswordGenerator passwordGenerator) {
return passwordGenerator;
}
@Binds
abstract PasswordGenerator providePasswordGenerator(RandomPasswordGenerator passwordGenerator);
@Provides
static Random provideRandom() {