1
1
/*
2
- * Copyright 2002-2021 the original author or authors.
2
+ * Copyright 2002-2022 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
48
48
* {@link #getGeneric(int...) generic parameters} along with the ability to ultimately
49
49
* {@link #resolve() resolve} to a {@link java.lang.Class}.
50
50
*
51
- * <p>{@code ResolvableTypes } may be obtained from {@link #forField(Field) fields },
52
- * {@link #forMethodParameter(Method, int) method parameters },
53
- * {@link #forMethodReturnType(Method) method returns} or
54
- * {@link #forClass(Class) classes }. Most methods on this class will themselves return
55
- * {@link ResolvableType ResolvableTypes }, allowing easy navigation. For example:
51
+ * <p>A {@code ResolvableType } may be obtained from a {@linkplain #forField(Field) field },
52
+ * a {@linkplain #forMethodParameter(Method, int) method parameter },
53
+ * a {@linkplain #forMethodReturnType(Method) method return type}, or a
54
+ * {@linkplain #forClass(Class) class }. Most methods on this class will themselves return
55
+ * a {@code ResolvableType}, allowing for easy navigation. For example:
56
56
* <pre class="code">
57
57
* private HashMap<Integer, List<String>> myMap;
58
58
*
@@ -182,7 +182,7 @@ private ResolvableType(Type type, @Nullable TypeProvider typeProvider,
182
182
183
183
/**
184
184
* Private constructor used to create a new {@link ResolvableType} on a {@link Class} basis.
185
- * Avoids all {@code instanceof} checks in order to create a straight {@link Class} wrapper.
185
+ * <p> Avoids all {@code instanceof} checks in order to create a straight {@link Class} wrapper.
186
186
* @since 4.2
187
187
*/
188
188
private ResolvableType (@ Nullable Class <?> clazz ) {
@@ -406,7 +406,7 @@ public ResolvableType getComponentType() {
406
406
407
407
/**
408
408
* Convenience method to return this type as a resolvable {@link Collection} type.
409
- * Returns {@link #NONE} if this type does not implement or extend
409
+ * <p> Returns {@link #NONE} if this type does not implement or extend
410
410
* {@link Collection}.
411
411
* @see #as(Class)
412
412
* @see #asMap()
@@ -417,7 +417,7 @@ public ResolvableType asCollection() {
417
417
418
418
/**
419
419
* Convenience method to return this type as a resolvable {@link Map} type.
420
- * Returns {@link #NONE} if this type does not implement or extend
420
+ * <p> Returns {@link #NONE} if this type does not implement or extend
421
421
* {@link Map}.
422
422
* @see #as(Class)
423
423
* @see #asCollection()
@@ -458,7 +458,7 @@ public ResolvableType as(Class<?> type) {
458
458
459
459
/**
460
460
* Return a {@link ResolvableType} representing the direct supertype of this type.
461
- * If no supertype is available this method returns {@link #NONE}.
461
+ * <p> If no supertype is available this method returns {@link #NONE}.
462
462
* <p>Note: The resulting {@link ResolvableType} instance may not be {@link Serializable}.
463
463
* @see #getInterfaces()
464
464
*/
@@ -607,7 +607,7 @@ private boolean isWildcardWithoutBounds() {
607
607
608
608
/**
609
609
* Return a {@link ResolvableType} for the specified nesting level.
610
- * See {@link #getNested(int, Map)} for details.
610
+ * <p> See {@link #getNested(int, Map)} for details.
611
611
* @param nestingLevel the nesting level
612
612
* @return the {@link ResolvableType} type, or {@code #NONE}
613
613
*/
@@ -995,7 +995,7 @@ public String toString() {
995
995
/**
996
996
* Return a {@link ResolvableType} for the specified {@link Class},
997
997
* using the full generic type information for assignability checks.
998
- * For example: {@code ResolvableType.forClass(MyArrayList.class)}.
998
+ * <p> For example: {@code ResolvableType.forClass(MyArrayList.class)}.
999
999
* @param clazz the class to introspect ({@code null} is semantically
1000
1000
* equivalent to {@code Object.class} for typical use cases here)
1001
1001
* @return a {@link ResolvableType} for the specified class
@@ -1010,7 +1010,7 @@ public static ResolvableType forClass(@Nullable Class<?> clazz) {
1010
1010
* Return a {@link ResolvableType} for the specified {@link Class},
1011
1011
* doing assignability checks against the raw class only (analogous to
1012
1012
* {@link Class#isAssignableFrom}, which this serves as a wrapper for.
1013
- * For example: {@code ResolvableType.forRawClass(List.class)}.
1013
+ * <p> For example: {@code ResolvableType.forRawClass(List.class)}.
1014
1014
* @param clazz the class to introspect ({@code null} is semantically
1015
1015
* equivalent to {@code Object.class} for typical use cases here)
1016
1016
* @return a {@link ResolvableType} for the specified class
@@ -1039,7 +1039,7 @@ public boolean isAssignableFrom(ResolvableType other) {
1039
1039
/**
1040
1040
* Return a {@link ResolvableType} for the specified base type
1041
1041
* (interface or base class) with a given implementation class.
1042
- * For example: {@code ResolvableType.forClass(List.class, MyArrayList.class)}.
1042
+ * <p> For example: {@code ResolvableType.forClass(List.class, MyArrayList.class)}.
1043
1043
* @param baseType the base type (must not be {@code null})
1044
1044
* @param implementationClass the implementation class
1045
1045
* @return a {@link ResolvableType} for the specified base type backed by the
@@ -1081,7 +1081,7 @@ public static ResolvableType forClassWithGenerics(Class<?> clazz, ResolvableType
1081
1081
Assert .notNull (clazz , "Class must not be null" );
1082
1082
Assert .notNull (generics , "Generics array must not be null" );
1083
1083
TypeVariable <?>[] variables = clazz .getTypeParameters ();
1084
- Assert .isTrue (variables .length == generics .length , "Mismatched number of generics specified" );
1084
+ Assert .isTrue (variables .length == generics .length , () -> "Mismatched number of generics specified for " + clazz . toGenericString () );
1085
1085
1086
1086
Type [] arguments = new Type [generics .length ];
1087
1087
for (int i = 0 ; i < generics .length ; i ++) {
@@ -1234,7 +1234,7 @@ public static ResolvableType forMethodReturnType(Method method) {
1234
1234
1235
1235
/**
1236
1236
* Return a {@link ResolvableType} for the specified {@link Method} return type.
1237
- * Use this variant when the class that declares the method includes generic
1237
+ * <p> Use this variant when the class that declares the method includes generic
1238
1238
* parameter variables that are satisfied by the implementation class.
1239
1239
* @param method the source for the method return type
1240
1240
* @param implementationClass the implementation class
0 commit comments