MCPcopy Create free account
hub / github.com/google/guice / configure

Method configure

core/test/com/google/inject/BindingTest.java:83–112  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

81 static class MyModule extends AbstractModule {
82
83 @Override
84 protected void configure() {
85 // Linked.
86 bind(Object.class).to(Runnable.class).in(Scopes.SINGLETON);
87
88 // Instance.
89 bind(Runnable.class).toInstance(Runnables.doNothing());
90
91 // Provider instance.
92 bind(Foo.class)
93 .toProvider(
94 new Provider<Foo>() {
95 @Override
96 public Foo get() {
97 return new Foo();
98 }
99 })
100 .in(Scopes.SINGLETON);
101
102 // Provider.
103 bind(Foo.class)
104 .annotatedWith(named("provider"))
105 .toProvider(FooProvider.class);
106
107 // Class.
108 bind(Bar.class).in(Scopes.SINGLETON);
109
110 // Constant.
111 bindConstant().annotatedWith(named("name")).to("Bob");
112 }
113 }
114
115 static class Foo {}

Callers

nothing calls this directly

Calls 9

namedMethod · 0.80
inMethod · 0.65
toMethod · 0.65
bindMethod · 0.65
toInstanceMethod · 0.65
toProviderMethod · 0.65
annotatedWithMethod · 0.65
bindConstantMethod · 0.65
doNothingMethod · 0.45

Tested by

no test coverage detected