Polishing
This commit is contained in:
@@ -24,6 +24,7 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* Generator of {@link ProxyHints} predicates, testing whether the given hints
|
||||
* match the expected behavior for proxies.
|
||||
*
|
||||
* @author Brian Clozel
|
||||
* @since 6.0
|
||||
*/
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
/**
|
||||
* Generator of {@link ReflectionHints} predicates, testing whether the given hints
|
||||
* match the expected behavior for reflection.
|
||||
*
|
||||
* @author Brian Clozel
|
||||
* @since 6.0
|
||||
*/
|
||||
@@ -265,6 +266,7 @@ public class ReflectionHintsPredicates {
|
||||
super(constructor);
|
||||
}
|
||||
|
||||
@Override
|
||||
MemberCategory[] getPublicMemberCategories() {
|
||||
if (this.executableMode == ExecutableMode.INTROSPECT) {
|
||||
return new MemberCategory[] {MemberCategory.INTROSPECT_PUBLIC_CONSTRUCTORS,
|
||||
@@ -273,6 +275,7 @@ public class ReflectionHintsPredicates {
|
||||
return new MemberCategory[] {MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS};
|
||||
}
|
||||
|
||||
@Override
|
||||
MemberCategory[] getDeclaredMemberCategories() {
|
||||
if (this.executableMode == ExecutableMode.INTROSPECT) {
|
||||
return new MemberCategory[] {MemberCategory.INTROSPECT_DECLARED_CONSTRUCTORS,
|
||||
@@ -299,6 +302,7 @@ public class ReflectionHintsPredicates {
|
||||
super(method);
|
||||
}
|
||||
|
||||
@Override
|
||||
MemberCategory[] getPublicMemberCategories() {
|
||||
if (this.executableMode == ExecutableMode.INTROSPECT) {
|
||||
return new MemberCategory[] {MemberCategory.INTROSPECT_PUBLIC_METHODS,
|
||||
@@ -307,6 +311,7 @@ public class ReflectionHintsPredicates {
|
||||
return new MemberCategory[] {MemberCategory.INVOKE_PUBLIC_METHODS};
|
||||
}
|
||||
|
||||
@Override
|
||||
MemberCategory[] getDeclaredMemberCategories() {
|
||||
|
||||
if (this.executableMode == ExecutableMode.INTROSPECT) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.springframework.lang.Nullable;
|
||||
* A {@link TypeReference} based on a {@link Class}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @since 6.0
|
||||
*/
|
||||
final class ReflectionTypeReference extends AbstractTypeReference {
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.springframework.util.ConcurrentLruCache;
|
||||
/**
|
||||
* Generator of {@link ResourceHints} predicates, testing whether the given hints
|
||||
* match the expected behavior for resources.
|
||||
*
|
||||
* @author Brian Clozel
|
||||
* @since 6.0
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,8 @@ package org.springframework.aot.hint;
|
||||
|
||||
/**
|
||||
* Static generator of predicates that test whether the given {@link RuntimeHints}
|
||||
* instance matches the expected behavior for reflection, resource or proxy generation.
|
||||
* instance matches the expected behavior for reflection, resource, or proxy generation.
|
||||
*
|
||||
* <p>This utility class can be used by {@link RuntimeHintsRegistrar} to conditionally
|
||||
* register hints depending on what's present already. This can also be used as a
|
||||
* testing utility for checking proper registration of hints:
|
||||
@@ -26,6 +27,7 @@ package org.springframework.aot.hint;
|
||||
* Predicate<RuntimeHints> predicate = RuntimeHintsPredicates.reflection().onMethod(MyClass.class, "someMethod").invoke();
|
||||
* assertThat(predicate).accepts(runtimeHints);
|
||||
* </pre>
|
||||
*
|
||||
* @author Brian Clozel
|
||||
* @since 6.0
|
||||
*/
|
||||
@@ -39,7 +41,6 @@ public abstract class RuntimeHintsPredicates {
|
||||
|
||||
|
||||
private RuntimeHintsPredicates() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.springframework.util.Assert;
|
||||
* A {@link TypeReference} based on fully qualified name.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @since 6.0
|
||||
*/
|
||||
final class SimpleTypeReference extends AbstractTypeReference {
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.params.provider.Arguments.arguments;
|
||||
|
||||
/**
|
||||
* Tests for {@link ReflectionTypeReference}.
|
||||
@@ -34,28 +35,24 @@ class ReflectionTypeReferenceTests {
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("reflectionTargetNames")
|
||||
void typeReferenceFromClasHasSuitableReflectionTargetName(TypeReference typeReference, String binaryName) {
|
||||
assertThat(typeReference.getName()).isEqualTo(binaryName);
|
||||
void typeReferenceFromClassHasSuitableReflectionTargetName(Class<?> clazz, String binaryName) {
|
||||
assertThat(ReflectionTypeReference.of(clazz).getName()).isEqualTo(binaryName);
|
||||
}
|
||||
|
||||
static Stream<Arguments> reflectionTargetNames() {
|
||||
return Stream.of(
|
||||
Arguments.of(ReflectionTypeReference.of(int.class), "int"),
|
||||
Arguments.of(ReflectionTypeReference.of(int[].class), "int[]"),
|
||||
Arguments.of(ReflectionTypeReference.of(Integer[].class), "java.lang.Integer[]"),
|
||||
Arguments.of(ReflectionTypeReference.of(Object[].class), "java.lang.Object[]"),
|
||||
Arguments.of(ReflectionTypeReference.of(StaticInner.class),
|
||||
"org.springframework.aot.hint.ReflectionTypeReferenceTests$StaticInner"),
|
||||
Arguments.of(ReflectionTypeReference.of(StaticInner[].class),
|
||||
"org.springframework.aot.hint.ReflectionTypeReferenceTests$StaticInner[]"),
|
||||
Arguments.of(ReflectionTypeReference.of(Inner.class),
|
||||
"org.springframework.aot.hint.ReflectionTypeReferenceTests$Inner"),
|
||||
Arguments.of(ReflectionTypeReference.of(Inner[].class),
|
||||
"org.springframework.aot.hint.ReflectionTypeReferenceTests$Inner[]")
|
||||
arguments(int.class, "int"),
|
||||
arguments(int[].class, "int[]"),
|
||||
arguments(Integer[].class, "java.lang.Integer[]"),
|
||||
arguments(Object[].class, "java.lang.Object[]"),
|
||||
arguments(StaticNested.class, "org.springframework.aot.hint.ReflectionTypeReferenceTests$StaticNested"),
|
||||
arguments(StaticNested[].class, "org.springframework.aot.hint.ReflectionTypeReferenceTests$StaticNested[]"),
|
||||
arguments(Inner.class, "org.springframework.aot.hint.ReflectionTypeReferenceTests$Inner"),
|
||||
arguments(Inner[].class, "org.springframework.aot.hint.ReflectionTypeReferenceTests$Inner[]")
|
||||
);
|
||||
}
|
||||
|
||||
static class StaticInner {
|
||||
static class StaticNested {
|
||||
}
|
||||
|
||||
class Inner {
|
||||
|
||||
Reference in New Issue
Block a user