Skip to content

Commit 178c796

Browse files
committed
Remove extra API to consider later
- Remove added API for BeanScope, reconsider later - Remove all unused associated code from that - Tidy formatting
1 parent 6a91cfc commit 178c796

File tree

7 files changed

+363
-392
lines changed

7 files changed

+363
-392
lines changed

blackbox-test-inject/src/main/java/org/example/myapp/generic/GenericFactory.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ public class GenericFactory {
88

99
@Bean
1010
Generic<Integer> one() {
11-
1211
return new Generic<>() {};
1312
}
1413

1514
@Bean
1615
Stringy two() {
17-
1816
return new Stringy() {};
1917
}
2018

blackbox-test-inject/src/test/java/org/example/myapp/generic/GenericFactoryTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ class GenericFactoryTest {
1616
@Test
1717
void test() {
1818
assertThat(intymcintface).isNotNull();
19+
assertThat(stringy).isNotNull();
1920
}
2021
}

inject-test/src/test/java/io/avaje/inject/test/MetaReaderTest.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616

1717
class MetaReaderTest {
1818

19-
@Mock Pump pump;
19+
@Mock
20+
Pump pump;
2021

21-
@Mock Grinder grinder;
22+
@Mock
23+
Grinder grinder;
2224

2325
static @Mock AMusher musher;
2426

@@ -44,13 +46,14 @@ void checkMetaReader_with_plugin() {
4446

4547
static class HelloBean {
4648

47-
@Inject HttpClient client;
49+
@Inject
50+
HttpClient client;
4851
}
4952

5053

5154
static class MyPlugin implements Plugin {
5255

53-
public boolean forType(Type type) {
56+
public boolean forType(Type type) {
5457
return HttpClient.class.equals(type);
5558
}
5659

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

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.avaje.inject;
22

3-
import io.avaje.inject.spi.Types;
43
import io.avaje.lang.NonNullApi;
54
import io.avaje.lang.Nullable;
65

@@ -140,48 +139,14 @@ static BeanScopeBuilder builder() {
140139
*/
141140
<T> T get(Class<T> type, @Nullable String name);
142141

143-
/**
144-
* Return a single bean given its type and generic components.
145-
*
146-
* <pre>{@code
147-
* Map<String, CoffeeMaker> coffeeMaker = beanScope.get(Map.class, String.class, CoffeeMaker.class);
148-
*
149-
* }</pre>
150-
*
151-
* @param base the base generic type
152-
* @param type component types of the generic type
153-
* @throws java.util.NoSuchElementException When no matching bean is found
154-
*/
155-
default <T> T get(Type base, Type... types) {
156-
return get(null, base, types);
157-
}
158-
159-
/**
160-
* Return a single bean given it's name, type, and generic components.
161-
*
162-
* <pre>{@code
163-
* Heater heater = beanScope.get("electric", Set.class, );
164-
* heater.heat();
165-
*
166-
* }</pre>
167-
*
168-
* @param type an interface or bean type
169-
* @param name the name qualifier of a specific bean
170-
* @throws java.util.NoSuchElementException When no matching bean is found
171-
*/
172-
default <T> T get(@Nullable String name, Type type, Type... types) {
173-
174-
return get(Types.parameterizedType(type, types), name);
175-
}
176-
177142
/**
178143
* Return a single bean given the full generic type.
179144
*
180145
* @param type The generic type
181146
* @throws java.util.NoSuchElementException When no matching bean is found
182147
*/
183148
default <T> T get(Type type) {
184-
return get(type, (String) null);
149+
return get(type, null);
185150
}
186151

187152
/**

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,7 @@ private <D> BeanScopeBuilder.ForTesting spy(Class<D> type, @Nullable String name
197197
return this;
198198
}
199199

200-
private <D> BeanScopeBuilder.ForTesting spy(
201-
Type type, @Nullable String name, @Nullable Consumer<D> consumer) {
200+
private <D> BeanScopeBuilder.ForTesting spy(Type type, @Nullable String name, @Nullable Consumer<D> consumer) {
202201
enrichBeans.add(new EnrichBean<>(type, name, consumer));
203202
return this;
204203
}

0 commit comments

Comments
 (0)