aboutsummaryrefslogtreecommitdiff
path: root/src/com/google/inject/Guice.java
blob: 4d0fd9c5bf7fa225529b34a30a3043363a0be979 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.google.inject;

import java.util.Arrays;

/**
 * TODO
 */
public final class Guice {

  public static Container createContainer(Module... modules)
      throws CreationException {
    return createContainer(Arrays.asList(modules));
  }

  public static Container createContainer(Iterable<Module> modules)
      throws CreationException {
    return createContainer(Stage.DEVELOPMENT, modules);
  }

  public static Container createContainer(Stage stage, Module... modules)
      throws CreationException {
    return createContainer(stage, Arrays.asList(modules));
  }

  public static Container createContainer(Stage stage, Iterable<Module> modules)
      throws CreationException {
    BinderImpl binder = new BinderImpl(stage);
    for (Module module : modules) {
      binder.install(module);
    }
    return binder.createContainer();

  }

  private Guice() {}
}