()
| 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 {} |
nothing calls this directly
no test coverage detected