Polishing
This commit is contained in:
parent
d7b45b7c8e
commit
9db43037fe
|
@ -48,11 +48,11 @@ public final class ClassProxyHint implements ConditionalHint {
|
|||
|
||||
/**
|
||||
* Initialize a builder with the target class to use.
|
||||
* @param targetClass the target class of the proxy
|
||||
* @param typeReference the type reference for the target class of the proxy
|
||||
* @return a builder for the hint
|
||||
*/
|
||||
public static Builder of(TypeReference targetClass) {
|
||||
return new Builder(targetClass);
|
||||
public static Builder of(TypeReference typeReference) {
|
||||
return new Builder(typeReference);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,8 +25,7 @@ import java.util.Objects;
|
|||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* A hint that describes the need of a JDK {@link Proxy}, that is an
|
||||
* interfaces-based proxy.
|
||||
* A hint that describes the need for a JDK interface-based {@link Proxy}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @author Brian Clozel
|
||||
|
@ -145,7 +144,7 @@ public final class JdkProxyHint implements ConditionalHint {
|
|||
|
||||
/**
|
||||
* Create a {@link JdkProxyHint} based on the state of this builder.
|
||||
* @return a jdk proxy hint
|
||||
* @return a JDK proxy hint
|
||||
*/
|
||||
JdkProxyHint build() {
|
||||
return new JdkProxyHint(this);
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.stream.Stream;
|
|||
import org.springframework.aot.hint.ClassProxyHint.Builder;
|
||||
|
||||
/**
|
||||
* Gather the need of using proxies at runtime.
|
||||
* Gather the need for using proxies at runtime.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @since 6.0
|
||||
|
@ -37,7 +37,7 @@ public class ProxyHints {
|
|||
|
||||
|
||||
/**
|
||||
* Return the interfaces-based proxies that are required.
|
||||
* Return the interface-based proxies that are required.
|
||||
* @return a stream of {@link JdkProxyHint}
|
||||
*/
|
||||
public Stream<JdkProxyHint> jdkProxies() {
|
||||
|
@ -54,7 +54,7 @@ public class ProxyHints {
|
|||
|
||||
/**
|
||||
* Register a {@link JdkProxyHint}.
|
||||
* @param jdkProxyHint the supplier to the hint
|
||||
* @param jdkProxyHint the consumer of the hint builder
|
||||
* @return {@code this}, to facilitate method chaining
|
||||
*/
|
||||
public ProxyHints registerJdkProxy(Consumer<JdkProxyHint.Builder> jdkProxyHint) {
|
||||
|
@ -66,8 +66,9 @@ public class ProxyHints {
|
|||
|
||||
/**
|
||||
* Register that a JDK proxy implementing the interfaces defined by the
|
||||
* specified {@link TypeReference type references} is required.
|
||||
* @param proxiedInterfaces the interfaces the proxy should implement
|
||||
* specified {@linkplain TypeReference type references} is required.
|
||||
* @param proxiedInterfaces the type references for the interfaces the proxy
|
||||
* should implement
|
||||
* @return {@code this}, to facilitate method chaining
|
||||
*/
|
||||
public ProxyHints registerJdkProxy(TypeReference... proxiedInterfaces) {
|
||||
|
@ -89,12 +90,12 @@ public class ProxyHints {
|
|||
/**
|
||||
* Register that a class proxy is required for the class defined by the
|
||||
* specified {@link TypeReference}.
|
||||
* @param targetClass the target class of the proxy
|
||||
* @param typeReference the type reference for the target class of the proxy
|
||||
* @param classProxyHint a builder to further customize the hint for that proxy
|
||||
* @return {@code this}, to facilitate method chaining
|
||||
*/
|
||||
public ProxyHints registerClassProxy(TypeReference targetClass, Consumer<Builder> classProxyHint) {
|
||||
return addClassProxyHint(ClassProxyHint.of(targetClass), classProxyHint);
|
||||
public ProxyHints registerClassProxy(TypeReference typeReference, Consumer<Builder> classProxyHint) {
|
||||
return addClassProxyHint(ClassProxyHint.of(typeReference), classProxyHint);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -59,13 +59,13 @@ class ProxyHintsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
void registerJdkProxyWithSupplier() {
|
||||
void registerJdkProxyWithConsumer() {
|
||||
this.proxyHints.registerJdkProxy(springProxy(TypeReference.of("com.example.Test")));
|
||||
assertThat(this.proxyHints.jdkProxies()).singleElement().satisfies(proxiedInterfaces(
|
||||
"com.example.Test",
|
||||
"org.springframework.aop.SpringProxy",
|
||||
"org.springframework.aop.framework.Advised",
|
||||
"org.springframework.core.DecoratingProxy",
|
||||
"com.example.Test"));
|
||||
"org.springframework.core.DecoratingProxy"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -102,10 +102,11 @@ class ProxyHintsTests {
|
|||
}
|
||||
|
||||
private static Consumer<JdkProxyHint.Builder> springProxy(TypeReference proxiedInterface) {
|
||||
return builder -> builder.proxiedInterfaces(Stream.of("org.springframework.aop.SpringProxy",
|
||||
return builder -> builder
|
||||
.proxiedInterfaces(proxiedInterface)
|
||||
.proxiedInterfaces(Stream.of("org.springframework.aop.SpringProxy",
|
||||
"org.springframework.aop.framework.Advised", "org.springframework.core.DecoratingProxy")
|
||||
.map(TypeReference::of).toArray(TypeReference[]::new))
|
||||
.proxiedInterfaces(proxiedInterface);
|
||||
.map(TypeReference::of).toArray(TypeReference[]::new));
|
||||
}
|
||||
|
||||
private Consumer<JdkProxyHint> proxiedInterfaces(String... proxiedInterfaces) {
|
||||
|
|
Loading…
Reference in New Issue