Skip to content

Commit c3677e7

Browse files
committed
Fix javadoc with ContextModule to InjectModule and context to scope
1 parent d0743b9 commit c3677e7

File tree

10 files changed

+45
-48
lines changed

10 files changed

+45
-48
lines changed

inject-test/src/test/java/org/example/coffee/CoffeeMaker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import jakarta.inject.Singleton;
66

7-
//@ContextModule(name = "coffee-maker")
7+
//@InjectModule(name = "coffee-maker")
88
@Singleton
99
public class CoffeeMaker {
1010

inject/src/main/java/io/avaje/inject/BeanEntry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package io.avaje.inject;
22

33
/**
4-
* A bean entry in the context with priority and optional name.
4+
* A bean entry with priority and optional name.
55
*/
66
public class BeanEntry<T> {
77

inject/src/main/java/io/avaje/inject/BeanScope.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ public interface BeanScope extends Closeable {
5959
* MyRedisApi mockRedis = mock(MyRedisApi.class);
6060
* MyDbApi mockDatabase = mock(MyDbApi.class);
6161
*
62-
* try (BeanScope context = BeanScope.newBuilder()
62+
* try (BeanScope scope = BeanScope.newBuilder()
6363
* .withBeans(mockRedis, mockDatabase)
6464
* .build()) {
6565
*
6666
* // built with test doubles injected ...
67-
* CoffeeMaker coffeeMaker = context.getBean(CoffeeMaker.class);
67+
* CoffeeMaker coffeeMaker = scope.get(CoffeeMaker.class);
6868
* coffeeMaker.makeIt();
6969
*
7070
* assertThat(...
@@ -248,7 +248,7 @@ default <T> List<T> getBeansByPriority(Class<T> interfaceType, Class<? extends A
248248
<T> RequestScopeMatch<T> requestProvider(Class<T> type, String name);
249249

250250
/**
251-
* Close the context firing any <code>@PreDestroy</code> methods.
251+
* Close the scope firing any <code>@PreDestroy</code> methods.
252252
*/
253253
void close();
254254
}

inject/src/main/java/io/avaje/inject/BeanScopeBuilder.java

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
* MyRedisApi mockRedis = mock(MyRedisApi.class);
1818
* MyDbApi mockDatabase = mock(MyDbApi.class);
1919
*
20-
* try (BeanScope context = BeanScope.newBuilder()
20+
* try (BeanScope scope = BeanScope.newBuilder()
2121
* .withBeans(mockRedis, mockDatabase)
2222
* .build()) {
2323
*
2424
* // built with test doubles injected ...
25-
* CoffeeMaker coffeeMaker = context.getBean(CoffeeMaker.class);
25+
* CoffeeMaker coffeeMaker = scope.get(CoffeeMaker.class);
2626
* coffeeMaker.makeIt();
2727
*
2828
* assertThat(...
@@ -43,11 +43,11 @@ public interface BeanScopeBuilder {
4343
*
4444
* // automatically closed via try with resources
4545
*
46-
* try (BeanScope context = BeanScope.newBuilder()
46+
* try (BeanScope scope = BeanScope.newBuilder()
4747
* .withNoShutdownHook()
4848
* .build()) {
4949
*
50-
* String makeIt = context.getBean(CoffeeMaker.class).makeIt();
50+
* String makeIt = scope.get(CoffeeMaker.class).makeIt();
5151
* }
5252
*
5353
* }</pre>
@@ -72,14 +72,14 @@ public interface BeanScopeBuilder {
7272
*
7373
* EmailServiceApi mockEmailService = mock(EmailServiceApi.class);
7474
*
75-
* try (BeanScope context = BeanScope.newBuilder()
75+
* try (BeanScope scope = BeanScope.newBuilder()
7676
* .withBeans(mockEmailService)
7777
* .withModules("coffee")
7878
* .withIgnoreMissingModuleDependencies()
7979
* .build()) {
8080
*
8181
* // built with test doubles injected ...
82-
* CoffeeMaker coffeeMaker = context.getBean(CoffeeMaker.class);
82+
* CoffeeMaker coffeeMaker = scope.get(CoffeeMaker.class);
8383
* coffeeMaker.makeIt();
8484
*
8585
* assertThat(...
@@ -100,8 +100,8 @@ public interface BeanScopeBuilder {
100100
BeanScopeBuilder withIgnoreMissingModuleDependencies();
101101

102102
/**
103-
* Supply a bean to the context that will be used instead of any
104-
* similar bean in the context.
103+
* Supply a bean to the scope that will be used instead of any
104+
* similar bean in the scope.
105105
* <p>
106106
* This is typically expected to be used in tests and the bean
107107
* supplied is typically a test double or mock.
@@ -112,15 +112,15 @@ public interface BeanScopeBuilder {
112112
* Pump pump = mock(Pump.class);
113113
* Grinder grinder = mock(Grinder.class);
114114
*
115-
* try (BeanScope context = BeanScope.newBuilder()
115+
* try (BeanScope scope = BeanScope.newBuilder()
116116
* .withBeans(pump, grinder)
117117
* .build()) {
118118
*
119-
* CoffeeMaker coffeeMaker = context.getBean(CoffeeMaker.class);
119+
* CoffeeMaker coffeeMaker = scope.get(CoffeeMaker.class);
120120
* coffeeMaker.makeIt();
121121
*
122-
* Pump pump1 = context.getBean(Pump.class);
123-
* Grinder grinder1 = context.getBean(Grinder.class);
122+
* Pump pump1 = scope.get(Pump.class);
123+
* Grinder grinder1 = scope.get(Grinder.class);
124124
*
125125
* assertThat(pump1).isSameAs(pump);
126126
* assertThat(grinder1).isSameAs(grinder);
@@ -146,15 +146,15 @@ public interface BeanScopeBuilder {
146146
*
147147
* Pump mockPump = ...
148148
*
149-
* try (BeanScope context = BeanScope.newBuilder()
149+
* try (BeanScope scope = BeanScope.newBuilder()
150150
* .withBean(Pump.class, mockPump)
151151
* .build()) {
152152
*
153-
* Pump pump = context.getBean(Pump.class);
153+
* Pump pump = scope.get(Pump.class);
154154
* assertThat(pump).isSameAs(mock);
155155
*
156156
* // act
157-
* CoffeeMaker coffeeMaker = context.getBean(CoffeeMaker.class);
157+
* CoffeeMaker coffeeMaker = scope.get(CoffeeMaker.class);
158158
* coffeeMaker.makeIt();
159159
*
160160
* verify(pump).pumpSteam();
@@ -182,7 +182,7 @@ public interface BeanScopeBuilder {
182182
*
183183
* <pre>{@code
184184
*
185-
* try (BeanScope context = BeanScope.newBuilder()
185+
* try (BeanScope scope = BeanScope.newBuilder()
186186
* .withMock(Pump.class)
187187
* .withMock(Grinder.class, grinder -> {
188188
* // setup the mock
@@ -191,11 +191,11 @@ public interface BeanScopeBuilder {
191191
* .build()) {
192192
*
193193
*
194-
* CoffeeMaker coffeeMaker = context.getBean(CoffeeMaker.class);
194+
* CoffeeMaker coffeeMaker = scope.get(CoffeeMaker.class);
195195
* coffeeMaker.makeIt();
196196
*
197197
* // this is a mockito mock
198-
* Grinder grinder = context.getBean(Grinder.class);
198+
* Grinder grinder = scope.get(Grinder.class);
199199
* verify(grinder).grindBeans();
200200
* }
201201
*
@@ -209,7 +209,7 @@ public interface BeanScopeBuilder {
209209
*
210210
* <pre>{@code
211211
*
212-
* try (BeanScope context = BeanScope.newBuilder()
212+
* try (BeanScope scope = BeanScope.newBuilder()
213213
* .withMock(Pump.class)
214214
* .withMock(Grinder.class, grinder -> {
215215
*
@@ -219,11 +219,11 @@ public interface BeanScopeBuilder {
219219
* .build()) {
220220
*
221221
*
222-
* CoffeeMaker coffeeMaker = context.getBean(CoffeeMaker.class);
222+
* CoffeeMaker coffeeMaker = scope.get(CoffeeMaker.class);
223223
* coffeeMaker.makeIt();
224224
*
225225
* // this is a mockito mock
226-
* Grinder grinder = context.getBean(Grinder.class);
226+
* Grinder grinder = scope.get(Grinder.class);
227227
* verify(grinder).grindBeans();
228228
* }
229229
*
@@ -236,16 +236,16 @@ public interface BeanScopeBuilder {
236236
*
237237
* <pre>{@code
238238
*
239-
* try (BeanScope context = BeanScope.newBuilder()
239+
* try (BeanScope scope = BeanScope.newBuilder()
240240
* .withSpy(Pump.class)
241241
* .build()) {
242242
*
243243
* // setup spy here ...
244-
* Pump pump = context.getBean(Pump.class);
244+
* Pump pump = scope.get(Pump.class);
245245
* doNothing().when(pump).pumpSteam();
246246
*
247247
* // act
248-
* CoffeeMaker coffeeMaker = context.getBean(CoffeeMaker.class);
248+
* CoffeeMaker coffeeMaker = scope.get(CoffeeMaker.class);
249249
* coffeeMaker.makeIt();
250250
*
251251
* verify(pump).pumpWater();
@@ -262,19 +262,19 @@ public interface BeanScopeBuilder {
262262
*
263263
* <pre>{@code
264264
*
265-
* try (BeanScope context = BeanScope.newBuilder()
265+
* try (BeanScope scope = BeanScope.newBuilder()
266266
* .withSpy(Pump.class, pump -> {
267267
* // setup the spy
268268
* doNothing().when(pump).pumpWater();
269269
* })
270270
* .build()) {
271271
*
272272
* // or setup here ...
273-
* Pump pump = context.getBean(Pump.class);
273+
* Pump pump = scope.get(Pump.class);
274274
* doNothing().when(pump).pumpSteam();
275275
*
276276
* // act
277-
* CoffeeMaker coffeeMaker = context.getBean(CoffeeMaker.class);
277+
* CoffeeMaker coffeeMaker = scope.get(CoffeeMaker.class);
278278
* coffeeMaker.makeIt();
279279
*
280280
* verify(pump).pumpWater();

inject/src/main/java/io/avaje/inject/DBeanScopeBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public BeanScope build() {
109109
" Review IntelliJ Settings / Build / Build tools / Gradle - 'Build and run using' value and set that to 'Gradle'. " +
110110
" Refer to https://avaje.io/inject#gradle");
111111
}
112-
log.debug("building context with modules {}", moduleNames);
112+
log.debug("building with modules {}", moduleNames);
113113
Builder builder = Builder.newBuilder(suppliedBeans, enrichBeans);
114114
for (BeanScopeFactory factory : factoryOrder.factories()) {
115115
factory.build(builder);

inject/src/main/java/io/avaje/inject/InjectModule.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
*
2121
* package org.example.featuretoggle;
2222
*
23-
* import io.avaje.inject.ContextModule;
23+
* import io.avaje.inject.InjectModule;
2424
*
25-
* @ContextModule(name = "feature-toggle")
25+
* @InjectModule(name = "feature-toggle")
2626
* public interface FeatureToggle {
2727
*
2828
* boolean isEnabled(String key);
@@ -44,9 +44,9 @@
4444
*
4545
* package org.example.jobsystem;
4646
*
47-
* import io.avaje.inject.ContextModule;
47+
* import io.avaje.inject.InjectModule;
4848
*
49-
* @ContextModule(name = "job-system", dependsOn = {"feature-toggle"})
49+
* @InjectModule(name = "job-system", dependsOn = {"feature-toggle"})
5050
* public interface JobSystem {
5151
*
5252
* ...
@@ -74,21 +74,21 @@
7474
*
7575
* // A module that provides 'email-service' and also 'health-check'.
7676
* // ie. it has bean(s) that implement a health check interface
77-
* @ContextModule(name="email-service", provides={"health-checks"})
77+
* @InjectModule(name="email-service", provides={"health-checks"})
7878
*
7979
* // provides beans that implement a health check interface
8080
* // ... wires after 'email-service'
81-
* @ContextModule(name="main", provides={"health-checks"}, dependsOn={"email-service"})
81+
* @InjectModule(name="main", provides={"health-checks"}, dependsOn={"email-service"})
8282
*
8383
* // wire this after all modules that provide 'health-checks'
84-
* @ContextModule(name="health-check-service", dependsOn={"health-checks"})
84+
* @InjectModule(name="health-check-service", dependsOn={"health-checks"})
8585
*
8686
* }</pre>
8787
*/
8888
String[] provides() default {};
8989

9090
/**
91-
* The list of modules this context depends on.
91+
* The list of modules this scope depends on.
9292
* <p>
9393
* Effectively dependsOn specifies the modules that must wire before this module.
9494
* </p>
@@ -97,7 +97,7 @@
9797
* // wire after a module that is called 'email-service'
9898
* // ... or any module that provides 'email-service'
9999
*
100-
* @ContextModule(name="...", dependsOn={"email-service"})
100+
* @InjectModule(name="...", dependsOn={"email-service"})
101101
*
102102
* }</pre>
103103
*/

inject/src/main/java/io/avaje/inject/RequestScope.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public interface RequestScope extends Closeable {
7070
void addClosable(Closeable closeable);
7171

7272
/**
73-
* Close the context firing any <code>@PreDestroy</code> methods.
73+
* Close the scope firing any <code>@PreDestroy</code> methods.
7474
*/
7575
void close();
7676

inject/src/main/java/io/avaje/inject/Secondary.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* the intended interface.
1111
* <p>
1212
* This can use be used when we have a 'default' implementation that would only be used when
13-
* no other implementation is available in the context to inject.
13+
* no other implementation is available in the scope to inject.
1414
* </p>
1515
*
1616
* <pre>{@code

inject/src/main/java/io/avaje/inject/spi/DBeanMap.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ class DBeanMap {
1616

1717
private NextBean nextBean;
1818

19-
/**
20-
* Create for context builder.
21-
*/
2219
DBeanMap() {
2320
}
2421

inject/src/main/java/io/avaje/inject/spi/DBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class DBuilder implements Builder {
2929
private final Map<String, RequestScopeMatch<?>> reqScopeProviders = new HashMap<>();
3030

3131
/**
32-
* The beans created and added to the context during building.
32+
* The beans created and added to the scope during building.
3333
*/
3434
final DBeanMap beanMap = new DBeanMap();
3535

0 commit comments

Comments
 (0)