當前位置: 首頁>>代碼示例>>Java>>正文


Java AbstractModule類代碼示例

本文整理匯總了Java中com.google.inject.AbstractModule的典型用法代碼示例。如果您正苦於以下問題:Java AbstractModule類的具體用法?Java AbstractModule怎麽用?Java AbstractModule使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AbstractModule類屬於com.google.inject包,在下文中一共展示了AbstractModule類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: mainExceptionTest

import com.google.inject.AbstractModule; //導入依賴的package包/類
@Test(expected = ConfigException.class)
public void mainExceptionTest() throws Exception {
    Injector injector = Guice.createInjector(new AbstractModule() {
        protected void configure() {
            bind(AccessService.class).toInstance(accessServiceMock);
            bind(InformationService.class).toInstance(informationServiceMock);
            bind(TemplateService.class).toInstance(templateServiceMock);
            bind(Integer.class).annotatedWith(Names.named("timeout")).toInstance(10);
            bind(Integer.class).annotatedWith(Names.named("interval")).toInstance(10);
            bind(Boolean.class).annotatedWith(Names.named("forceMode")).toInstance(false);
            bind(Double.class).annotatedWith(Names.named("placeWidth")).toInstance(1200d);
            bind(PositionDTO.class).annotatedWith(Names.named("startPosition")).toInstance(new PositionDTO());
        }
    });
    //given
    PowerMockito.mockStatic(Guice.class);
    Mockito.when(Guice.createInjector((AbstractModule)anyObject())).thenReturn(injector);
    doThrow(new ApiException()).when(accessServiceMock).addTokenOnConfiguration(false, null ,null);
    Main.main(new String[]{"-nifi","http://localhost:8080/nifi-api","-branch","\"root>N2\"","-conf","adr","-m","undeploy"});
}
 
開發者ID:hermannpencole,項目名稱:nifi-config,代碼行數:21,代碼來源:MainTest.java

示例2: newIsisWicketModule

import com.google.inject.AbstractModule; //導入依賴的package包/類
@Override
protected Module newIsisWicketModule() {
    final Module isisDefaults = super.newIsisWicketModule();
    
    final Module overrides = new AbstractModule() {
        @Override
        protected void configure() {
            bind(ComponentFactoryRegistrar.class).to(MyComponentFactoryRegistrar.class);

            bind(String.class).annotatedWith(Names.named("applicationName")).toInstance("RotaBuilder");
            bind(String.class).annotatedWith(Names.named("applicationCss")).toInstance("css/application.css");
            bind(String.class).annotatedWith(Names.named("applicationJs")).toInstance("scripts/application.js");
            bind(String.class).annotatedWith(Names.named("welcomeMessage")).toInstance(readLines(getClass(), "welcome.html"));
            bind(String.class).annotatedWith(Names.named("aboutMessage")).toInstance("RotaBuilder");
            bind(InputStream.class).annotatedWith(Names.named("metaInfManifest")).toProvider(
                    Providers.of(getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF")));
            // if uncommented, then overrides isis.appManifest in config file.
            // bind(AppManifest.class).toInstance(new DomainAppAppManifest());
        }
    };

    return Modules.override(isisDefaults).with(overrides);
}
 
開發者ID:bibryam,項目名稱:rotabuilder,代碼行數:24,代碼來源:DomainApplication.java

示例3: configureModules

import com.google.inject.AbstractModule; //導入依賴的package包/類
@Override
protected void configureModules() {
	super.configureModules();
	addModule(new AbstractModule() {

		@Override
		public void configure() {
			bind(IWorldMessageTranslator.class).to(ServerFSM.class);
			bind(IWorldView.class).to(IVisionWorldView.class);
			bind(IVisionWorldView.class).to(UT2004WorldView.class);
			bind(ComponentDependencies.class).annotatedWith(Names.named(UT2004WorldView.WORLDVIEW_DEPENDENCY)).toProvider(worldViewDependenciesProvider);
			bind(IAgent.class).to(IWorldServer.class);
			bind(IWorldServer.class).to(IUT2004Server.class);
			bind(IUT2004Server.class).to(UT2004TCServer.class);
		}

	});
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:19,代碼來源:UT2004TCServerModule.java

示例4: configureModules

import com.google.inject.AbstractModule; //導入依賴的package包/類
@Override
protected void configureModules() {
	super.configureModules();
	addModule(new AbstractModule() {

		@Override
		public void configure() {
			bind(IWorldMessageTranslator.class).to(ServerFSM.class);
			bind(IWorldView.class).to(IVisionWorldView.class);
			bind(IVisionWorldView.class).to(UT2004WorldView.class);
			bind(ComponentDependencies.class).annotatedWith(Names.named(UT2004WorldView.WORLDVIEW_DEPENDENCY)).toProvider(worldViewDependenciesProvider);
			bind(IAgent.class).to(IWorldServer.class);
			bind(IWorldServer.class).to(IUT2004Server.class);
			bind(IUT2004Server.class).to(UT2004HSServer.class);
		}

	});
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:19,代碼來源:UT2004HSServerModule.java

示例5: configureModules

import com.google.inject.AbstractModule; //導入依賴的package包/類
@Override
protected void configureModules() {
	super.configureModules();
	addModule(new AbstractModule() {

		@Override
		public void configure() {
			bind(IWorldMessageTranslator.class).to(ObserverFSM.class);
			bind(IWorldView.class).to(IVisionWorldView.class);
			bind(IVisionWorldView.class).to(UT2004WorldView.class);
			bind(ComponentDependencies.class).annotatedWith(Names.named(UT2004WorldView.WORLDVIEW_DEPENDENCY)).toProvider(worldViewDependenciesProvider);
			bind(IAgent.class).to(IUT2004Observer.class);
			
			// THIS tells guice it should instantiate our class and not default one
			bind(IUT2004Observer.class).to(HSObserver.class); 
		}

	});
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:20,代碼來源:HSObserverModule.java

示例6: configureModules

import com.google.inject.AbstractModule; //導入依賴的package包/類
@Override
protected void configureModules() {
	super.configureModules();
	addModule(new AbstractModule() {

		@Override
		public void configure() {
			bind(IWorldMessageTranslator.class).to(ServerFSM.class);
			bind(IWorldView.class).to(IVisionWorldView.class);
			bind(IVisionWorldView.class).to(UT2004WorldView.class);
			bind(ComponentDependencies.class).annotatedWith(Names.named(UT2004WorldView.WORLDVIEW_DEPENDENCY)).toProvider(worldViewDependenciesProvider);
			bind(IAgent.class).to(IWorldServer.class);
			bind(IWorldServer.class).to(IUT2004Server.class);
			bind(IUT2004Server.class).to(UT2004TagServer.class);
		}

	});
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:19,代碼來源:UT2004TagServerModule.java

示例7: configureModules

import com.google.inject.AbstractModule; //導入依賴的package包/類
@Override
protected void configureModules() {
	super.configureModules();
	addModule(new AbstractModule() {

		@Override
		public void configure() {
			bind(IWorldMessageTranslator.class).to(ServerFSM.class);
			bind(IWorldView.class).to(IVisionWorldView.class);
			bind(IVisionWorldView.class).to(UT2004WorldView.class);
			bind(ComponentDependencies.class).annotatedWith(Names.named(UT2004WorldView.WORLDVIEW_DEPENDENCY)).toProvider(worldViewDependenciesProvider);
			bind(IAgent.class).to(IWorldServer.class);
			bind(IWorldServer.class).to(IUT2004Server.class);
			bind(IUT2004Server.class).to(UT2004VIPServer.class);
		}

	});
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:19,代碼來源:UT2004VIPServerModule.java

示例8: configureModules

import com.google.inject.AbstractModule; //導入依賴的package包/類
@Override
protected void configureModules() {
	super.configureModules();
	addModule(new AbstractModule() {

		@Override
		public void configure() {
			bind(IWorldMessageTranslator.class).to(ObserverFSM.class);
			bind(IWorldView.class).to(IVisionWorldView.class);
			bind(IVisionWorldView.class).to(UT2004WorldView.class);
			bind(ComponentDependencies.class).annotatedWith(Names.named(UT2004WorldView.WORLDVIEW_DEPENDENCY)).toProvider(worldViewDependenciesProvider);
			bind(IAgent.class).to(IUT2004Observer.class);
			
			// THIS tells guice it should instantiate our class and not default one
			bind(IUT2004Observer.class).to(CSObserver.class); 
		}

	});
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:20,代碼來源:CSObserverModule.java

示例9: configureModules

import com.google.inject.AbstractModule; //導入依賴的package包/類
@Override
protected void configureModules() {
	super.configureModules();
	
	addModule(
			new AbstractModule() {

				@Override
				protected void configure() {
					bind(ICommandSerializer.class).to(StringCommandSerializer.class);
					bind(IAct.class).to(Act.class);
					bind(IWorldReaderProvider.class).to(IWorldConnection.class);
					bind(IWorldWriterProvider.class).to(IWorldConnection.class);
				}				
				
			}
		);		
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:19,代碼來源:GuiceRemoteAgentModule.java

示例10: configureModules

import com.google.inject.AbstractModule; //導入依賴的package包/類
@Override
protected void configureModules() {
	super.configureModules();
	addModule(new AbstractModule() {

		@Override
		public void configure() {
			bind(IWorldConnection.class).to(SocketConnection.class);
			bind(ComponentDependencies.class).annotatedWith(Names.named(SocketConnection.CONNECTION_DEPENDENCY)).toProvider(connectionDependenciesProvider);
               bind(ISocketConnectionAddress.class).annotatedWith(Names.named(SocketConnection.CONNECTION_ADDRESS_DEPENDENCY)).toProvider((Provider<ISocketConnectionAddress>) getAddressProvider());
			bind(IWorldMessageParser.class).to(UT2004Parser.class);
			bind(ItemTypeTranslator.class).to(UT2004ItemTypeTranslator.class);
			bind(IYylex.class).to(IUT2004Yylex.class);
			bind(IUT2004Yylex.class).to(Yylex.class);
			bind(IYylexObserver.class).to(IYylexObserver.LogObserver.class);
			bind(UT2004AgentParameters.class).toProvider(getAgentParamsProvider());
		}
		
	});
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:21,代碼來源:UT2004CommunicationModule.java

示例11: configureModules

import com.google.inject.AbstractModule; //導入依賴的package包/類
@Override
protected void configureModules() {
	super.configureModules();
	addModule(new AbstractModule() {

		@Override
		public void configure() {
			bind(IWorldMessageTranslator.class).to(ObserverFSM.class);
			bind(IWorldView.class).to(IVisionWorldView.class);
			bind(IVisionWorldView.class).to(UT2004WorldView.class);
			bind(ComponentDependencies.class).annotatedWith(Names.named(UT2004WorldView.WORLDVIEW_DEPENDENCY)).toProvider(worldViewDependenciesProvider);
			bind(IAgent.class).to(IUT2004Observer.class);
			bind(IUT2004Observer.class).to(UT2004Observer.class);				
		}
		
	});
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:18,代碼來源:UT2004ObserverModule.java

示例12: configureModules

import com.google.inject.AbstractModule; //導入依賴的package包/類
@Override
protected void configureModules() {
	super.configureModules();
	addModule(new AbstractModule() {

		@Override
		public void configure() {
			bind(IWorldMessageTranslator.class).to(ServerFSM.class);
			bind(IWorldView.class).to(IVisionWorldView.class);
			bind(IVisionWorldView.class).to(UT2004WorldView.class);
			bind(ComponentDependencies.class).annotatedWith(Names.named(UT2004WorldView.WORLDVIEW_DEPENDENCY)).toProvider(worldViewDependenciesProvider);
			bind(IAgent.class).to(IWorldServer.class);
			bind(IWorldServer.class).to(IUT2004Server.class);
			bind(IUT2004Server.class).to(UT2004Server.class);				
		}
		
	});
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:19,代碼來源:UT2004ServerModule.java

示例13: configureModules

import com.google.inject.AbstractModule; //導入依賴的package包/類
@Override
protected void configureModules() {
	super.configureModules();
	addModule(new AbstractModule() {

		@Override
		public void configure() {
			bind(IWorldMessageTranslator.class).to(BotFSM.class);
			bind(IWorldView.class).to(IVisionWorldView.class);
			bind(IVisionWorldView.class).to(ILockableVisionWorldView.class);
			bind(ILockableWorldView.class).to(ILockableVisionWorldView.class);
			bind(ILockableVisionWorldView.class).to(UT2004SyncLockableWorldView.class);
			bind(ComponentDependencies.class).annotatedWith(Names.named(UT2004SyncLockableWorldView.WORLDVIEW_DEPENDENCY)).toProvider(worldViewDependenciesProvider);
			bind(IAgent.class).to(IAgent3D.class);
			bind(IAgent3D.class).to(IUT2004Bot.class);
			bind(IUT2004Bot.class).to(UT2004Bot.class);
			if (botControllerClass != null) {
				bind(IUT2004BotController.class).to(botControllerClass);
			}
			bind(UT2004BotParameters.class).toProvider((Provider<? extends UT2004BotParameters>) getAgentParamsProvider());
		}
		
	});
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:25,代碼來源:UT2004BotModule.java

示例14: setUp

import com.google.inject.AbstractModule; //導入依賴的package包/類
@BeforeEach
public void setUp() {
  Injector injector =
      Guice.createInjector(
          Modules.override(
                  new DatasetModule(), new CannedDatasetsModule(), new ConfigurationModule())
              .with(
                  new MongoOverrideModule(),
                  new AbstractModule() {
                    @Override
                    protected void configure() {
                      bind(CannedDatasetsLoader.class)
                          .toInstance(Mockito.mock(CannedDatasetsLoader.class));
                    }
                  }));
  injector.injectMembers(this);

  when(mongoProvider.provide()).thenReturn(getMongoClient());
}
 
開發者ID:glytching,項目名稱:dragoman,代碼行數:20,代碼來源:MongoCannedDatasetsWriterTest.java

示例15: trueMain

import com.google.inject.AbstractModule; //導入依賴的package包/類
private static void trueMain(String[] argv) throws IOException {
  final Parameters params = Parameters.loadSerifStyle(new File(argv[0]));
  Guice.createInjector(new AbstractModule() {
    @Override
    protected void configure() {
      try {
        bind(EREToKBPEventOntologyMapper.class)
            .toInstance(EREToKBPEventOntologyMapper.create2016Mapping());
      } catch (IOException ioe) {
        throw new TACKBPEALException(ioe);
      }
    }

    @Provides
    ERELoader ereLoader() {
      return ERELoader.builder().build();
    }
  }).getInstance(DerivedQuerySelector2016.class)
      .go(params.copyNamespace("com.bbn.tac.eal"));
}
 
開發者ID:isi-nlp,項目名稱:tac-kbp-eal,代碼行數:21,代碼來源:DerivedQuerySelector2016.java


注:本文中的com.google.inject.AbstractModule類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。