当前位置: 首页>>代码示例>>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;未经允许,请勿转载。