Home
last modified time | relevance | path

Searched refs:toInstance (Results 1 – 25 of 68) sorted by relevance

123

/external/guice/extensions/multibindings/test/com/google/inject/multibindings/
DMapBinderTest.java170 multibinder.addBinding("a").toInstance("A"); in testMapBinderAggregatesMultipleModules()
171 multibinder.addBinding("b").toInstance("B"); in testMapBinderAggregatesMultipleModules()
172 multibinder.addBinding("c").toInstance("C"); in testMapBinderAggregatesMultipleModules()
179 multibinder.addBinding("d").toInstance("D"); in testMapBinderAggregatesMultipleModules()
180 multibinder.addBinding("e").toInstance("E"); in testMapBinderAggregatesMultipleModules()
201 multibinder.addBinding("a").toInstance("A"); in testMapBinderAggregationForAnnotationInstance()
202 multibinder.addBinding("b").toInstance("B"); in testMapBinderAggregationForAnnotationInstance()
206 multibinder.addBinding("c").toInstance("C"); in testMapBinderAggregationForAnnotationInstance()
227 multibinder.addBinding("a").toInstance("A"); in testMapBinderAggregationForAnnotationType()
228 multibinder.addBinding("b").toInstance("B"); in testMapBinderAggregationForAnnotationType()
[all …]
DMultibinderTest.java107 multibinder.addBinding().toInstance("A"); in testMultibinderAggregatesMultipleModules()
108 multibinder.addBinding().toInstance("B"); in testMultibinderAggregatesMultipleModules()
109 multibinder.addBinding().toInstance("C"); in testMultibinderAggregatesMultipleModules()
115 multibinder.addBinding().toInstance("D"); in testMultibinderAggregatesMultipleModules()
116 multibinder.addBinding().toInstance("E"); in testMultibinderAggregatesMultipleModules()
135 multibinder.addBinding().toInstance("A"); in testMultibinderAggregationForAnnotationInstance()
136 multibinder.addBinding().toInstance("B"); in testMultibinderAggregationForAnnotationInstance()
139 multibinder.addBinding().toInstance("C"); in testMultibinderAggregationForAnnotationInstance()
157 multibinder.addBinding().toInstance("A"); in testMultibinderAggregationForAnnotationType()
158 multibinder.addBinding().toInstance("B"); in testMultibinderAggregationForAnnotationType()
[all …]
DOptionalBinderTest.java222 OptionalBinder.newOptionalBinder(binder(), String.class).setDefault().toInstance("a"); in testSetDefault()
261 OptionalBinder.newOptionalBinder(binder(), String.class).setBinding().toInstance("a"); in testSetBinding()
302 optionalBinder.setDefault().toInstance("a"); in testSetBindingOverridesDefault()
303 optionalBinder.setBinding().toInstance("b"); in testSetBindingOverridesDefault()
353 OptionalBinder.newOptionalBinder(binder(), String.class).setDefault().toInstance("a"); in testSpreadAcrossModules()
358 OptionalBinder.newOptionalBinder(binder(), String.class).setBinding().toInstance("b"); in testSpreadAcrossModules()
405 .toInstance(new String("a")); // using new String to ensure .equals is checked. in testExactSameBindingCollapses_defaults()
407 .toInstance(new String("a")); in testExactSameBindingCollapses_defaults()
447 .toInstance(new String("a")); // using new String to ensure .equals is checked. in testExactSameBindingCollapses_actual()
449 .toInstance(new String("a")); in testExactSameBindingCollapses_actual()
[all …]
/external/guice/core/test/com/google/inject/util/
DOverrideModuleTest.java111 bind(String.class).toInstance("A"); in testGetProviderInModule()
124 bind(String.class).toInstance("A"); in testOverrideWhatGetProviderProvided()
139 bind(String.class).toInstance("A"); in testOverrideUsingOriginalsGetProvider()
140 bind(key2).toInstance("B"); in testOverrideUsingOriginalsGetProvider()
158 bind(String.class).toInstance("A1"); in testOverrideOfOverride()
159 bind(key2).toInstance("A2"); in testOverrideOfOverride()
160 bind(key3).toInstance("A3"); in testOverrideOfOverride()
166 bind(String.class).toInstance("B1"); in testOverrideOfOverride()
167 bind(key2).toInstance("B2"); in testOverrideOfOverride()
175 bind(String.class).toInstance("C1"); in testOverrideOfOverride()
[all …]
/external/guice/core/test/com/google/inject/
DPrivateModuleTest.java46 bind(String.class).annotatedWith(named("a")).toInstance("public"); in testBasicUsage()
50 bind(String.class).annotatedWith(named("b")).toInstance("i"); in testBasicUsage()
59 bind(String.class).annotatedWith(named("b")).toInstance("ii"); in testBasicUsage()
81 bindA.bind(String.class).annotatedWith(named("a")).toInstance("i"); in testWithoutPrivateModules()
83 bindA.bind(String.class).annotatedWith(named("c")).toInstance("private to A"); in testWithoutPrivateModules()
86 bindB.bind(String.class).annotatedWith(named("b")).toInstance("ii"); in testWithoutPrivateModules()
88 bindB.bind(String.class).annotatedWith(named("c")).toInstance("private to B"); in testWithoutPrivateModules()
183 bind(String.class).toInstance("public"); in testCannotBindAKeyExportedByASibling()
190 bind(String.class).toInstance("private"); in testCannotBindAKeyExportedByASibling()
208 bind(String.class).annotatedWith(named("a")).toInstance("a"); in testExposeButNoBind()
[all …]
DOptionalBindingTest.java47 bind(A.class).toInstance(injectA);
48 bind(B.class).toInstance(injectB);
49 bind(C.class).toInstance(injectC);
50 bind(D.class).toInstance(injectD);
51 bind(E.class).annotatedWith(Names.named("e")).toInstance(injectE);
52 bind(F.class).toInstance(injectF);
53 bind(G.class).toInstance(injectG);
59 bind(C.class).toInstance(new C() {});
66 .toInstance(new HasOptionalInjections());
DProviderInjectionTest.java105 bind(Boolean.class).toInstance(Boolean.TRUE); in testProvidersAreInjectedBeforeTheyAreUsed()
123 bind(Count.class).annotatedWith(named("a")).toInstance(new Count(0) { in testCreationTimeInjectionOrdering()
141 bind(Count.class).annotatedWith(named("c")).toInstance(new Count(0) { in testCreationTimeInjectionOrdering()
151 bind(Count.class).annotatedWith(named("d")).toInstance(new Count(8)); in testCreationTimeInjectionOrdering()
152 bind(Count.class).annotatedWith(named("e")).toInstance(new Count(16)); in testCreationTimeInjectionOrdering()
DBoundInstanceInjectionTest.java41 bind(O.class).toInstance(o); in testInstancesAreInjected()
42 bind(int.class).toInstance(5); in testInstancesAreInjected()
68 bind(int.class).toInstance(5); in testProvidersAreInjected()
79 bind(Object.class).toInstance(new MalformedInjectable()); in testMalformedInstance()
DBinderTest.java184 bind(String.class).annotatedWith(Names.named("nullTwo")).toInstance(none); in testBindingNullConstant()
254 bind(String[].class).toInstance(strings); in testArrayTypeCanonicalization()
255 bind(new TypeLiteral<Integer[]>() {}).toInstance(integers); in testArrayTypeCanonicalization()
270 bind(String[].class).toInstance(new String[] { "A" }); in testArrayTypeCanonicalization()
271 bind(new TypeLiteral<String[]>() {}).toInstance(new String[] { "B" }); in testArrayTypeCanonicalization()
286 bind(String[].class).toInstance(strings); in testArrayTypeCanonicalization()
287 bind(new TypeLiteral<String[]>() {}).toInstance(strings); in testArrayTypeCanonicalization()
317 bind(String.class).toInstance(constant); in configure()
347 bind(HasImplementedBy1.class).toInstance(new HasImplementedBy1() {}); in testSettingAtImplementedByTwice()
370 bind(HasImplementedBy1.class).toInstance(new HasImplementedBy1() {}); in testJitDependencyDoesntBlockOtherExplicitBindings()
[all …]
DInjectorTest.java62 bind(SampleSingleton.class).toInstance(singleton); in testProviderMethods()
65 .toInstance(other); in testProviderMethods()
253 bind(String.class).toInstance("foo");
254 bind(int.class).toInstance(5);
281 bind(String.class).toInstance("foo");
282 bind(int.class).toInstance(5);
309 bind(Object.class).toInstance(new Object() {
DMembersInjectorTest.java80 bind(C.class).toInstance(myFavouriteC); in testMembersInjectorFromBinder()
101 bind(C.class).toInstance(myFavouriteC); in testMembersInjectorFromInjector()
161 bind(C.class).toInstance(myFavouriteC); in testInjectingMembersInjector()
216 bind(C.class).toInstance(myFavouriteC); in testLookupMembersInjectorBinding()
DLoggerInjectionTest.java53 .toInstance(Logger.getAnonymousLogger()); in testCanBindAnnotatedLogger()
64 bind(Logger.class).toInstance(Logger.getAnonymousLogger()); in testCannotBindLogger()
DReflectionTest.java40 bind(Foo.class).toInstance(foo); in testNormalBinding()
70 bind(Bar.class).toInstance(bar); in testLinkedBinding()
DTypeLiteralInjectionTest.java39 bind(TypeLiteral.class).toInstance(TypeLiteral.get(String.class)); in testBindingToRawTypeLiteralIsNotAllowed()
54 .toInstance(TypeLiteral.get(String.class)); in testBindingToParameterizedTypeLiteralIsNotAllowed()
/external/guice/extensions/assistedinject/test/com/google/inject/assistedinject/
DFactoryProviderTest.java58 bind(Double.class).toInstance(5.0d); in testAssistedFactory()
78 bind(Double.class).toInstance(5.0d); in testFactoryBindingDependencies()
94 bind(int.class).annotatedWith(Names.named("horsePower")).toInstance(250); in testAssistedFactoryWithAnnotations()
95 bind(int.class).annotatedWith(Names.named("modelYear")).toInstance(1984); in testAssistedFactoryWithAnnotations()
157 bind(float.class).toInstance(140f); in testFactoryWithMultipleMethods()
230 bind(String.class).toInstance("turbo"); in testMethodsAndFieldsGetInjected()
231 bind(int.class).toInstance(911); in testMethodsAndFieldsGetInjected()
232 bind(double.class).toInstance(50000d); in testMethodsAndFieldsGetInjected()
267 bind(String.class).toInstance("trans am"); in testProviderInjection()
294 bind(new TypeLiteral<Set<String>>() {}).toInstance(Collections.singleton("Flux Capacitor")); in testTypeTokenInjection()
[all …]
DFactoryProvider2Test.java54 bind(Double.class).toInstance(5.0d); in testAssistedFactory()
74 bind(int.class).annotatedWith(Names.named("horsePower")).toInstance(250); in testAssistedFactoryWithAnnotations()
75 bind(int.class).annotatedWith(Names.named("modelYear")).toInstance(1984); in testAssistedFactoryWithAnnotations()
137 bind(float.class).toInstance(140f); in testFactoryUsesInjectedConstructor()
195 bind(String.class).toInstance("turbo"); in testMethodsAndFieldsGetInjected()
196 bind(int.class).toInstance(911); in testMethodsAndFieldsGetInjected()
197 bind(double.class).toInstance(50000d); in testMethodsAndFieldsGetInjected()
232 bind(String.class).toInstance("trans am"); in testProviderInjection()
259 bind(String.class).toInstance("trans am"); in testAssistedProviderInjection()
292 bind(new TypeLiteral<Set<String>>() {}).toInstance(Collections.singleton("Flux Capacitor")); in testTypeTokenInjection()
[all …]
DFactoryModuleBuilderTest.java179 bind(Integer.class).toInstance(911); in testAnnotatedAndParentBoundReturnValue()
180 bind(Double.class).toInstance(5.0d); in testAnnotatedAndParentBoundReturnValue()
197 bind(Double.class).toInstance(5.0d); in testParentBoundReturnValue()
299 bind(Double.class).toInstance(5.0d); in testMultipleReturnTypes()
409 bind(Integer.class).toInstance(42); in testFactoryBindingDependencies()
410 bind(Double.class).toInstance(4.2d); in testFactoryBindingDependencies()
411 bind(Float.class).toInstance(4.2f); in testFactoryBindingDependencies()
412 bind(String.class).annotatedWith(named("dog")).toInstance("dog"); in testFactoryBindingDependencies()
413 bind(String.class).annotatedWith(named("cat1")).toInstance("cat1"); in testFactoryBindingDependencies()
414 bind(String.class).annotatedWith(named("cat2")).toInstance("cat2"); in testFactoryBindingDependencies()
[all …]
DExtensionSpiTest.java173 bind(String.class).annotatedWith(named("catName1")).toInstance("kitty1"); in configure()
174 bind(String.class).annotatedWith(named("catName2")).toInstance("kitty2"); in configure()
175 bind(String.class).annotatedWith(named("petName")).toInstance("pussy"); in configure()
176 bind(Integer.class).annotatedWith(named("age")).toInstance(12); in configure()
/external/guice/core/test/com/googlecode/guice/
DJsr330Test.java64 bind(B.class).toInstance(b); in testInject()
65 bind(C.class).toInstance(c); in testInject()
66 bind(D.class).toInstance(d); in testInject()
67 bind(E.class).toInstance(e); in testInject()
82 bind(B.class).annotatedWith(Names.named("jodie")).toInstance(b); in testQualifiedInject()
83 bind(C.class).annotatedWith(Red.class).toInstance(c); in testQualifiedInject()
84 bind(D.class).annotatedWith(RED).toInstance(d); in testQualifiedInject()
85 bind(E.class).annotatedWith(Names.named("jesse")).toInstance(e); in testQualifiedInject()
100 bind(B.class).annotatedWith(Names.named("jodie")).toInstance(b); in testProviderInject()
101 bind(C.class).toInstance(c); in testProviderInject()
[all …]
/external/guice/core/test/com/google/inject/spi/
DModuleRewriterTest.java44 bind(String.class).toInstance("Pizza"); in testRewriteBindings()
45 bind(CharSequence.class).toInstance("Wine"); in testRewriteBindings()
100 bind(String.class).toInstance("A"); in testGetProviderAvailableAtInjectMembersTime()
DHasDependenciesTest.java43 bind(A.class).toInstance(new AWithDependencies()); in testInstanceWithDependencies()
55 bind(A.class).toInstance(new A()); in testInstanceWithoutDependencies()
/external/guice/core/test/com/google/inject/internal/
DWeakKeySetTest.java339 bind(Integer.class).toInstance(4); in testWeakKeySet_integration()
346 bind(String.class).toInstance("bar"); in testWeakKeySet_integration()
361 bind(Integer.class).toInstance(4); in testWeakKeySet_integration_multipleChildren()
369 bind(String.class).toInstance("foo"); in testWeakKeySet_integration_multipleChildren()
378 bind(Long.class).toInstance(6L); in testWeakKeySet_integration_multipleChildren()
401 bind(Integer.class).toInstance(4); in testWeakKeySet_integration_multipleChildren_overlappingKeys()
408 bind(String.class).toInstance("foo"); in testWeakKeySet_integration_multipleChildren_overlappingKeys()
416 bind(String.class).toInstance("bar"); in testWeakKeySet_integration_multipleChildren_overlappingKeys()
/external/guice/core/src/com/google/inject/name/
DNames.java51 binder.bind(Key.get(String.class, new NamedImpl(key))).toInstance(value); in bindProperties()
67 binder.bind(Key.get(String.class, new NamedImpl(propertyName))).toInstance(value); in bindProperties()
/external/guice/extensions/throwingproviders/test/com/google/inject/throwingproviders/
DThrowingProviderTest.java429 bind(String.class).toInstance("Foo"); in testDependencies_Bind()
430 bind(Integer.class).toInstance(5); in testDependencies_Bind()
431 bind(Double.class).toInstance(5d); in testDependencies_Bind()
432 bind(Long.class).toInstance(5L); in testDependencies_Bind()
463 bind(String.class).toInstance("Foo"); in testDependencies_Provides()
464 bind(Integer.class).toInstance(5); in testDependencies_Provides()
465 bind(Double.class).toInstance(5d); in testDependencies_Provides()
466 bind(Long.class).toInstance(5L); in testDependencies_Provides()
DCheckedProviderTest.java551 bind(String.class).toInstance("Foo"); in testDependencies_Bind()
552 bind(Integer.class).toInstance(5); in testDependencies_Bind()
553 bind(Double.class).toInstance(5d); in testDependencies_Bind()
554 bind(Long.class).toInstance(5L); in testDependencies_Bind()
581 bind(String.class).toInstance("Foo"); in testDependencies_Provides()
582 bind(Integer.class).toInstance(5); in testDependencies_Provides()
583 bind(Double.class).toInstance(5d); in testDependencies_Provides()
584 bind(Long.class).toInstance(5L); in testDependencies_Provides()
613 bind(String.class).toInstance("Foo"); in testDependencies_Cxtor()
614 bind(Integer.class).toInstance(5); in testDependencies_Cxtor()
[all …]

123