Add dagger map for injecting DnsWriter implementations

This is one of several CLs in a sequence for allowing per-TLD DNS
implementations.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129445641
This commit is contained in:
Greg Shikhman 2016-08-05 08:45:02 -07:00 committed by Justine Tunney
parent 770fd35e20
commit a620d06239
24 changed files with 173 additions and 215 deletions

View file

@ -14,21 +14,26 @@
package google.registry.dns.writer.dnsupdate;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import google.registry.model.dns.DnsWriter;
import dagger.multibindings.IntoMap;
import dagger.multibindings.StringKey;
import google.registry.dns.writer.DnsWriter;
import javax.net.SocketFactory;
/** Dagger module that provides a DnsUpdateWriter. */
@Module
public abstract class DnsUpdateWriterModule {
@Binds
abstract DnsWriter provideDnsWriter(DnsUpdateWriter dnsWriter);
@Provides
static SocketFactory provideSocketFactory() {
return SocketFactory.getDefault();
}
@Provides
@IntoMap
@StringKey(DnsUpdateWriter.NAME)
static DnsWriter provideDnsUpdateWriter(DnsUpdateWriter writer) {
return writer;
}
}