@Test public void testSimple() { final GalaxyAnnouncementModule module = new GalaxyAnnouncementModule(); final AnnouncementConfig cfg = module.getAnnouncementConfig(config); Assert.assertEquals("configured-service", cfg.getServiceName()); Assert.assertEquals("configured-type", cfg.getServiceType()); Assert.assertEquals(false, cfg.isAnnounceInternal()); Assert.assertEquals(true, cfg.isAnnounceExternal()); }
@Provides @Singleton AnnouncementConfig getAnnouncementConfig(final Config config) { final AnnouncementConfig baseConfig = config.getBean(AnnouncementConfig.class); return new AnnouncementConfig(baseConfig) { @Override public String getServiceName() { return ObjectUtils.toString(super.getServiceName(), serviceName); } @Override public String getServiceType() { return ObjectUtils.toString(super.getServiceType(), serviceType); } }; }
GalaxyAnnouncementModule extends AbstractModule { @Provides @Singleton AnnouncementConfig getAnnouncementConfig(final Config config) { final AnnouncementConfig baseConfig = config.getBean(AnnouncementConfig.class); return new AnnouncementConfig(baseConfig) { @Override public String getServiceName() { return ObjectUtils.toString(super.getServiceName(), serviceName); } @Override public String getServiceType() { return ObjectUtils.toString(super.getServiceType(), serviceType); } }; } }
GalaxyAnnouncementModule extends AbstractModule { @Provides @Singleton AnnouncementConfig getAnnouncementConfig(final Config config) { final AnnouncementConfig baseConfig = config.getBean(AnnouncementConfig.class); return new AnnouncementConfig(baseConfig) { @Override public String getServiceName() { return ObjectUtils.toString(super.getServiceName(), serviceName); } @Override public String getServiceType() { return ObjectUtils.toString(super.getServiceType(), serviceType); } }; } GalaxyAnnouncementModule();  GalaxyAnnouncementModule(final String serviceName, final String serviceType); }
GalaxyAnnouncementModule extends AbstractModule { @Provides @Singleton AnnouncementConfig getAnnouncementConfig(final Config config) { final AnnouncementConfig baseConfig = config.getBean(AnnouncementConfig.class); return new AnnouncementConfig(baseConfig) { @Override public String getServiceName() { return ObjectUtils.toString(super.getServiceName(), serviceName); } @Override public String getServiceType() { return ObjectUtils.toString(super.getServiceType(), serviceType); } }; } GalaxyAnnouncementModule();  GalaxyAnnouncementModule(final String serviceName, final String serviceType); @Override void configure(); }
GalaxyAnnouncementModule extends AbstractModule { @Provides @Singleton AnnouncementConfig getAnnouncementConfig(final Config config) { final AnnouncementConfig baseConfig = config.getBean(AnnouncementConfig.class); return new AnnouncementConfig(baseConfig) { @Override public String getServiceName() { return ObjectUtils.toString(super.getServiceName(), serviceName); } @Override public String getServiceType() { return ObjectUtils.toString(super.getServiceType(), serviceType); } }; } GalaxyAnnouncementModule();  GalaxyAnnouncementModule(final String serviceName, final String serviceType); @Override void configure();  }