com.google.inject.util.Modules.combine()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(177)

本文整理了Java中com.google.inject.util.Modules.combine()方法的一些代码示例,展示了Modules.combine()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Modules.combine()方法的具体详情如下:
包路径:com.google.inject.util.Modules
类名称:Modules
方法名:combine

Modules.combine介绍

[英]Returns a new module that installs all of modules.
[中]返回安装所有模块的新模块。

代码示例

代码示例来源:origin: com.google.inject/guice

/** Returns a new module that installs all of {@code modules}. */
public static Module combine(Module... modules) {
 return combine(ImmutableSet.copyOf(modules));
}

代码示例来源:origin: org.xbib/guice

/**
 * Returns a new module that installs all of {@code modules}.
 */
public static Module combine(Module... modules) {
  return combine(ImmutableSet.copyOf(modules));
}

代码示例来源:origin: com.netflix.governator/governator-core

/**
 * Add additional bindings to the module tracked by the DSL
 * @param modules
 */
public InjectorBuilder combineWith(Module ... modules) {
  List<Module> m = new ArrayList<>();
  m.add(module);
  m.addAll(Arrays.asList(modules));
  this.module = Modules.combine(m);
  return this;
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.inject

/**
 * Returns a new module that installs all of {@code modules}.
 */
public static Module combine(Module... modules) {
 return combine(ImmutableSet.of(modules));
}

代码示例来源:origin: Nextdoor/bender

/**
 * Returns a new module that installs all of {@code modules}.
 */
public static Module combine(Module... modules) {
 return combine(ImmutableSet.of(modules));
}

代码示例来源:origin: com.netflix.governator/governator-core

@Override
 public Module transform(Module module) {
   List<Module> modulesToTransform = Collections.singletonList(module);
   for (ModuleListTransformer transformer : transformers) {
     modulesToTransform = transformer.transform(Collections.unmodifiableList(modulesToTransform));
   }
   return Modules.combine(modulesToTransform);
 }
})

代码示例来源:origin: matsim-org/matsim

private static Module insertMapBindings(List<Module> guiceModules) {
  com.google.inject.AbstractModule routingModuleBindings = createMapBindingsForType(guiceModules, RoutingModule.class);
  com.google.inject.AbstractModule travelTimeBindings = createMapBindingsForType(guiceModules, TravelTime.class);
  com.google.inject.AbstractModule travelDisutilityFactoryBindings = createMapBindingsForType(guiceModules, TravelDisutilityFactory.class);
  return Modules.combine(Modules.combine(guiceModules), routingModuleBindings, travelTimeBindings, travelDisutilityFactoryBindings);
}

代码示例来源:origin: com.teradata.tempto/tempto-core

private Injector buildInjector()
{
  return createInjector(combine(baseModule, statesModule(), testContextModule()));
}

代码示例来源:origin: co.cask.cdap/cdap-explore

@Override
public Module getInMemoryModules() {
 // Turning off assertions for Hive packages, since some assertions in StandardStructObjectInspector do not work
 // when outer joins are run. It is okay to turn off Hive assertions since we assume Hive is a black-box that does
 // the right thing, and we only want to test our/our user's code.
 getClass().getClassLoader().setPackageAssertionStatus("org.apache.hadoop.hive", false);
 getClass().getClassLoader().setPackageAssertionStatus("org.apache.hive", false);
 return Modules.combine(new ExploreExecutorModule(), new ExploreLocalModule(true));
}

代码示例来源:origin: cdapio/cdap

@Override
public Module getInMemoryModules() {
 // Turning off assertions for Hive packages, since some assertions in StandardStructObjectInspector do not work
 // when outer joins are run. It is okay to turn off Hive assertions since we assume Hive is a black-box that does
 // the right thing, and we only want to test our/our user's code.
 getClass().getClassLoader().setPackageAssertionStatus("org.apache.hadoop.hive", false);
 getClass().getClassLoader().setPackageAssertionStatus("org.apache.hive", false);
 return Modules.combine(new ExploreExecutorModule(), new ExploreLocalModule(true));
}

代码示例来源:origin: co.cask.cdap/cdap-explore

@Override
public Module getDistributedModules() {
 return Modules.combine(new ExploreExecutorModule(), new ExploreDistributedModule());
}

代码示例来源:origin: cdapio/cdap

@Override
 protected Module createModule(CConfiguration cConf, Configuration hConf,
                ProgramOptions programOptions, ProgramRunId programRunId) {
  Module module = super.createModule(cConf, hConf, programOptions, programRunId);
  return Modules.combine(module, new DistributedArtifactManagerModule());
 }
}

代码示例来源:origin: co.cask.cdap/cdap-app-fabric

@Override
 protected Module createModule(CConfiguration cConf, Configuration hConf,
                ProgramOptions programOptions, ProgramRunId programRunId) {
  Module module = super.createModule(cConf, hConf, programOptions, programRunId);
  return Modules.combine(module, new DistributedArtifactManagerModule());
 }
}

代码示例来源:origin: co.cask.cdap/cdap-app-fabric

@Override
public Module getInMemoryModules() {
 // No remote execution module in unit-test
 return Modules.combine(new InMemoryProgramRunnerModule(streamWriterClass),
             new ProgramStateWriterModule());
}

代码示例来源:origin: co.cask.cdap/cdap-app-fabric

@Override
 protected Module createModule(CConfiguration cConf, Configuration hConf,
                ProgramOptions programOptions, ProgramRunId programRunId) {
  Module module = super.createModule(cConf, hConf, programOptions, programRunId);
  return Modules.combine(module, new FactoryModuleBuilder()
   .implement(StreamWriter.class, DefaultStreamWriter.class)
   .build(StreamWriterFactory.class));
 }
}

代码示例来源:origin: cdapio/cdap

@Override
public Module getStandaloneModules() {
 return Modules.combine(new InMemoryProgramRunnerModule(),
             new RemoteExecutionProgramRunnerModule(),
             new ProgramStateWriterModule());
}

代码示例来源:origin: co.cask.cdap/cdap-app-fabric

@Override
public Module getStandaloneModules() {
 // In standalone, we always use the DefaultStreamWriter
 return Modules.combine(new InMemoryProgramRunnerModule(DefaultStreamWriter.class),
             new RemoteExecutionProgramRunnerModule(),
             new ProgramStateWriterModule());
}

代码示例来源:origin: org.apache.james/james-server-guice-common

@Override
public Module getModule() {
  List<Module> modules = subrule
        .stream()
        .map(GuiceModuleTestRule::getModule)
        .collect(Guavate.toImmutableList());
  return Modules.combine(modules);
}

代码示例来源:origin: co.cask.cdap/cdap-app-fabric

@Override
public Module getDistributedModules() {
 return Modules.combine(new DistributedProgramRunnerModule(),
             new RemoteExecutionProgramRunnerModule(),
             new ProgramStateWriterModule());
}

代码示例来源:origin: org.apache.james/james-server-guice-common

public static GuiceJamesServer forConfiguration(Configuration configuration) {
  IsStartedProbe isStartedProbe = new IsStartedProbe();
  return new GuiceJamesServer(
    isStartedProbe,
    Modules.combine(
      new IsStartedProbeModule(isStartedProbe),
      new CommonServicesModule(configuration),
      new MailetProcessingModule()));
}

相关文章