Skip to content

Commit 9db4303

Browse files
committed
Polishing
1 parent d7b45b7 commit 9db4303

File tree

4 files changed

+21
-20
lines changed

4 files changed

+21
-20
lines changed

spring-core/src/main/java/org/springframework/aot/hint/ClassProxyHint.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ private ClassProxyHint(Builder builder) {
4848

4949
/**
5050
* Initialize a builder with the target class to use.
51-
* @param targetClass the target class of the proxy
51+
* @param typeReference the type reference for the target class of the proxy
5252
* @return a builder for the hint
5353
*/
54-
public static Builder of(TypeReference targetClass) {
55-
return new Builder(targetClass);
54+
public static Builder of(TypeReference typeReference) {
55+
return new Builder(typeReference);
5656
}
5757

5858
/**

spring-core/src/main/java/org/springframework/aot/hint/JdkProxyHint.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
import org.springframework.lang.Nullable;
2626

2727
/**
28-
* A hint that describes the need of a JDK {@link Proxy}, that is an
29-
* interfaces-based proxy.
28+
* A hint that describes the need for a JDK interface-based {@link Proxy}.
3029
*
3130
* @author Stephane Nicoll
3231
* @author Brian Clozel
@@ -145,7 +144,7 @@ public Builder onReachableType(TypeReference reachableType) {
145144

146145
/**
147146
* Create a {@link JdkProxyHint} based on the state of this builder.
148-
* @return a jdk proxy hint
147+
* @return a JDK proxy hint
149148
*/
150149
JdkProxyHint build() {
151150
return new JdkProxyHint(this);

spring-core/src/main/java/org/springframework/aot/hint/ProxyHints.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.springframework.aot.hint.ClassProxyHint.Builder;
2525

2626
/**
27-
* Gather the need of using proxies at runtime.
27+
* Gather the need for using proxies at runtime.
2828
*
2929
* @author Stephane Nicoll
3030
* @since 6.0
@@ -37,7 +37,7 @@ public class ProxyHints {
3737

3838

3939
/**
40-
* Return the interfaces-based proxies that are required.
40+
* Return the interface-based proxies that are required.
4141
* @return a stream of {@link JdkProxyHint}
4242
*/
4343
public Stream<JdkProxyHint> jdkProxies() {
@@ -54,7 +54,7 @@ public Stream<ClassProxyHint> classProxies() {
5454

5555
/**
5656
* Register a {@link JdkProxyHint}.
57-
* @param jdkProxyHint the supplier to the hint
57+
* @param jdkProxyHint the consumer of the hint builder
5858
* @return {@code this}, to facilitate method chaining
5959
*/
6060
public ProxyHints registerJdkProxy(Consumer<JdkProxyHint.Builder> jdkProxyHint) {
@@ -66,8 +66,9 @@ public ProxyHints registerJdkProxy(Consumer<JdkProxyHint.Builder> jdkProxyHint)
6666

6767
/**
6868
* Register that a JDK proxy implementing the interfaces defined by the
69-
* specified {@link TypeReference type references} is required.
70-
* @param proxiedInterfaces the interfaces the proxy should implement
69+
* specified {@linkplain TypeReference type references} is required.
70+
* @param proxiedInterfaces the type references for the interfaces the proxy
71+
* should implement
7172
* @return {@code this}, to facilitate method chaining
7273
*/
7374
public ProxyHints registerJdkProxy(TypeReference... proxiedInterfaces) {
@@ -89,12 +90,12 @@ public ProxyHints registerJdkProxy(Class<?>... proxiedInterfaces) {
8990
/**
9091
* Register that a class proxy is required for the class defined by the
9192
* specified {@link TypeReference}.
92-
* @param targetClass the target class of the proxy
93+
* @param typeReference the type reference for the target class of the proxy
9394
* @param classProxyHint a builder to further customize the hint for that proxy
9495
* @return {@code this}, to facilitate method chaining
9596
*/
96-
public ProxyHints registerClassProxy(TypeReference targetClass, Consumer<Builder> classProxyHint) {
97-
return addClassProxyHint(ClassProxyHint.of(targetClass), classProxyHint);
97+
public ProxyHints registerClassProxy(TypeReference typeReference, Consumer<Builder> classProxyHint) {
98+
return addClassProxyHint(ClassProxyHint.of(typeReference), classProxyHint);
9899
}
99100

100101
/**

spring-core/src/test/java/org/springframework/aot/hint/ProxyHintsTests.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ void registerJdkProxyWithInterfaceClassNames() {
5959
}
6060

6161
@Test
62-
void registerJdkProxyWithSupplier() {
62+
void registerJdkProxyWithConsumer() {
6363
this.proxyHints.registerJdkProxy(springProxy(TypeReference.of("com.example.Test")));
6464
assertThat(this.proxyHints.jdkProxies()).singleElement().satisfies(proxiedInterfaces(
65+
"com.example.Test",
6566
"org.springframework.aop.SpringProxy",
6667
"org.springframework.aop.framework.Advised",
67-
"org.springframework.core.DecoratingProxy",
68-
"com.example.Test"));
68+
"org.springframework.core.DecoratingProxy"));
6969
}
7070

7171
@Test
@@ -102,10 +102,11 @@ void registerClassProxyWithTargetInterface() {
102102
}
103103

104104
private static Consumer<JdkProxyHint.Builder> springProxy(TypeReference proxiedInterface) {
105-
return builder -> builder.proxiedInterfaces(Stream.of("org.springframework.aop.SpringProxy",
105+
return builder -> builder
106+
.proxiedInterfaces(proxiedInterface)
107+
.proxiedInterfaces(Stream.of("org.springframework.aop.SpringProxy",
106108
"org.springframework.aop.framework.Advised", "org.springframework.core.DecoratingProxy")
107-
.map(TypeReference::of).toArray(TypeReference[]::new))
108-
.proxiedInterfaces(proxiedInterface);
109+
.map(TypeReference::of).toArray(TypeReference[]::new));
109110
}
110111

111112
private Consumer<JdkProxyHint> proxiedInterfaces(String... proxiedInterfaces) {

0 commit comments

Comments
 (0)