Skip to content

Commit b5999ed

Browse files
authored
Adapts to changes in microbean-bean 0.0.17 (#5)
Signed-off-by: Laird Nelson <[email protected]>
1 parent c7979f8 commit b5999ed

File tree

12 files changed

+684
-45
lines changed

12 files changed

+684
-45
lines changed

pom.xml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
<dependency>
126126
<groupId>org.junit</groupId>
127127
<artifactId>junit-bom</artifactId>
128-
<version>5.11.4</version>
128+
<version>5.12.2</version>
129129
<type>pom</type>
130130
<scope>import</scope>
131131
</dependency>
@@ -134,7 +134,7 @@
134134
<dependency>
135135
<groupId>org.jboss.weld</groupId>
136136
<artifactId>weld-core-bom</artifactId>
137-
<version>6.0.0.Final</version>
137+
<version>6.0.2.Final</version>
138138
<type>pom</type>
139139
<scope>import</scope>
140140
</dependency>
@@ -150,7 +150,7 @@
150150
<dependency>
151151
<groupId>org.microbean</groupId>
152152
<artifactId>microbean-bean</artifactId>
153-
<version>0.0.16</version>
153+
<version>0.0.17</version>
154154
</dependency>
155155

156156
<dependency>
@@ -184,6 +184,12 @@
184184

185185
<!-- Test-scoped dependencies. -->
186186

187+
<dependency>
188+
<groupId>org.jboss.weld.se</groupId>
189+
<artifactId>weld-se-core</artifactId>
190+
<scope>test</scope>
191+
</dependency>
192+
187193
<dependency>
188194
<groupId>org.junit.jupiter</groupId>
189195
<artifactId>junit-jupiter-api</artifactId>
@@ -213,7 +219,7 @@
213219
<artifactId>maven-checkstyle-plugin</artifactId>
214220
<version>3.6.0</version>
215221
<configuration>
216-
<checkstyleRules>
222+
<checkstyleRules>
217223
<module name="Checker">
218224
<module name="BeforeExecutionExclusionFileFilter">
219225
<property name="fileNamePattern" value="module\-info\.java$" />
@@ -438,14 +444,7 @@
438444
</plugin>
439445
<plugin>
440446
<artifactId>maven-surefire-plugin</artifactId>
441-
<version>3.5.2</version>
442-
<dependencies>
443-
<dependency>
444-
<groupId>org.apache.maven.surefire</groupId>
445-
<artifactId>surefire-junit-platform</artifactId>
446-
<version>3.5.2</version>
447-
</dependency>
448-
</dependencies>
447+
<version>3.5.3</version>
449448
</plugin>
450449
<plugin>
451450
<artifactId>maven-toolchains-plugin</artifactId>
@@ -454,7 +453,7 @@
454453
<plugin>
455454
<groupId>com.github.spotbugs</groupId>
456455
<artifactId>spotbugs-maven-plugin</artifactId>
457-
<version>4.9.2.0</version>
456+
<version>4.9.3.0</version>
458457
</plugin>
459458
<plugin>
460459
<groupId>org.codehaus.mojo</groupId>
@@ -464,7 +463,7 @@
464463
<plugin>
465464
<groupId>io.smallrye</groupId>
466465
<artifactId>jandex-maven-plugin</artifactId>
467-
<version>3.2.7</version>
466+
<version>3.3.0</version>
468467
</plugin>
469468
<plugin>
470469
<groupId>org.sonatype.plugins</groupId>

src/main/java/org/microbean/reference/AbstractClientProxier.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
import javax.lang.model.element.TypeElement;
3030

3131
import org.microbean.bean.BeanTypeList;
32+
import org.microbean.bean.Creation;
3233
import org.microbean.bean.Id;
33-
import org.microbean.bean.Request;
3434

3535
import org.microbean.construct.Domain;
3636

@@ -148,7 +148,7 @@ protected ClassLoader classLoader(final TypeElement e) {
148148
*
149149
* @param <R> the type of the contextual reference
150150
*
151-
* @param r the {@link Request} necessitating this invocation; must not be {@code null}
151+
* @param id an {@link Id} qualifying the contextual instance that will be proxied; must not be {@code null}
152152
*
153153
* @param instanceSupplier a {@link Supplier} of contextual instances of type {@code R}; must not be {@code null}
154154
*
@@ -157,7 +157,7 @@ protected ClassLoader classLoader(final TypeElement e) {
157157
* @exception NullPointerException if any argument is {@code null}, or if the {@link #instantiate(ProxySpecification,
158158
* Supplier)} method, invoked as part of the implementation of this method, returns {@code null}
159159
*
160-
* @exception IllegalArgumentException if the supplied {@link Request} is not proxiable for any reason
160+
* @exception IllegalArgumentException if the supplied {@link Id} is not proxiable for any reason
161161
*
162162
* @exception ReferenceException if the {@link #instantiate(ProxySpecification, Supplier)} method throws a checked
163163
* {@link Exception}
@@ -169,12 +169,7 @@ protected ClassLoader classLoader(final TypeElement e) {
169169
// By the time we get here, proxying is absolutely called for. (If we can't return an R, something went wrong, it's
170170
// not that the inputs were unsuitable.)
171171
@Override // ClientProxier
172-
public final <R> R clientProxy(final Request<R> r, final Supplier<? extends R> instanceSupplier) {
173-
return this.clientProxy(r.beanReduction().bean().id(), instanceSupplier);
174-
}
175-
176-
// Called only by #clientProxy(Request, Supplier).
177-
private final <R> R clientProxy(final Id id, final Supplier<? extends R> instanceSupplier) {
172+
public final <R> R clientProxy(final Id id, final Supplier<? extends R> instanceSupplier) {
178173
return this.clientProxy(id.types(), id.attributes(), instanceSupplier);
179174
}
180175

@@ -314,7 +309,7 @@ protected T generate(final ProxySpecification ps) throws Throwable {
314309
}
315310

316311
/**
317-
* Called indirectly by the {@link #clientProxy(Request, Supplier)} method when a new {@link ClientProxy
312+
* Called indirectly by the {@link #clientProxy(Id, Supplier)} method when a new {@link ClientProxy
318313
* ClientProxy&lt;R&gt;} instance needs to be created, creates a new instance of a {@link ClientProxy
319314
* ClientProxy&lt;R&gt;} that proxies contextual instances supplied by the supplied {@code instanceSupplier}, and
320315
* returns it.

src/main/java/org/microbean/reference/ClientProxier.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515

1616
import java.util.function.Supplier;
1717

18-
import org.microbean.bean.Request;
18+
import org.microbean.bean.Id;
1919

2020
/**
21-
* A supplier of {@link ClientProxy} instances.
21+
* A source of {@link ClientProxy} instances.
2222
*
2323
* @author <a href="https://about.me/lairdnelson" target="_top">Laird Nelson</a>
2424
*
25-
* @see #clientProxy(Request, Supplier)
25+
* @see #clientProxy(Id, Supplier)
2626
*/
2727
@FunctionalInterface
2828
public interface ClientProxier {
@@ -35,7 +35,7 @@ public interface ClientProxier {
3535
*
3636
* @param <R> the type of the contextual reference
3737
*
38-
* @param r the {@link Request} necessitating this invocation; must not be {@code null}
38+
* @param id an {@link Id} qualifying the contextual instance that will be proxied; must not be {@code null}
3939
*
4040
* @param instanceSupplier a {@link Supplier} of contextual instances of the appropriate type; must not be {@code null}
4141
*
@@ -45,6 +45,6 @@ public interface ClientProxier {
4545
*
4646
* @see ClientProxy
4747
*/
48-
public <R> R clientProxy(final Request<R> r, final Supplier<? extends R> instanceSupplier);
48+
public <R> R clientProxy(final Id id, final Supplier<? extends R> instanceSupplier);
4949

5050
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/* -*- mode: Java; c-basic-offset: 2; indent-tabs-mode: nil; coding: utf-8-unix -*-
2+
*
3+
* Copyright © 2023–2025 microBean™.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
6+
* the License. You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
11+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
12+
* specific language governing permissions and limitations under the License.
13+
*/
14+
package org.microbean.reference;
15+
16+
import java.util.function.Supplier;
17+
18+
/**
19+
* A supplier of {@link ClientProxy} instances.
20+
*
21+
* @author <a href="https://about.me/lairdnelson" target="_top">Laird Nelson</a>
22+
*
23+
* @see #clientProxy(Request, Supplier)
24+
*/
25+
@FunctionalInterface
26+
public interface ClientProxier {
27+
28+
/**
29+
* Returns a <dfn>contextual reference</dfn> which is also a {@link ClientProxy}, given a
30+
* {@link Supplier} of <dfn>contextual instances</dfn> of the appropriate type.
31+
*
32+
* <p>Implementations of this method may return {@code null}.</p>
33+
*
34+
* @param <R> the type of the contextual reference
35+
*
36+
* @param r the {@link Request} necessitating this invocation; must not be {@code null}
37+
*
38+
* @param instanceSupplier a {@link Supplier} of contextual instances of the appropriate type; must not be {@code null}
39+
*
40+
* @return a contextual reference, which may be {@code null}
41+
*
42+
* @exception NullPointerException if any argument is {@code null}
43+
*
44+
* @see ClientProxy
45+
*/
46+
public <R> R clientProxy(final Request<R> r, final Supplier<? extends R> instanceSupplier);
47+
48+
}

src/main/java/org/microbean/reference/DefaultRequest.java renamed to src/main/java/org/microbean/reference/DefaultRequest.java.bak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public <J> DefaultRequest<J> child(final BeanReduction<J> beanReduction) {
196196
return child;
197197
}
198198

199-
@Override // AutoCloseableRegistry, Instances (AutoCloseable), Request (AutoCloseable)
199+
@Override // AutoCloseableRegistry
200200
public void close() {
201201
this.acr.close();
202202
this.instances.close();

0 commit comments

Comments
 (0)