40
40
41
41
/**
42
42
* Spring Data specific reflection utility methods and classes.
43
- *
43
+ *
44
44
* @author Oliver Gierke
45
45
* @author Thomas Darimont
46
46
* @author Christoph Strobl
@@ -56,7 +56,7 @@ public class ReflectionUtils {
56
56
/**
57
57
* Creates an instance of the class with the given fully qualified name or returns the given default instance if the
58
58
* class cannot be loaded or instantiated.
59
- *
59
+ *
60
60
* @param classname the fully qualified class name to create an instance for.
61
61
* @param defaultInstance the instance to fall back to in case the given class cannot be loaded or instantiated.
62
62
* @return
@@ -74,39 +74,39 @@ public static <T> T createInstanceIfPresent(String classname, T defaultInstance)
74
74
75
75
/**
76
76
* A {@link FieldFilter} that has a description.
77
- *
77
+ *
78
78
* @author Oliver Gierke
79
79
*/
80
80
public interface DescribedFieldFilter extends FieldFilter {
81
81
82
82
/**
83
83
* Returns the description of the field filter. Used in exceptions being thrown in case uniqueness shall be enforced
84
84
* on the field filter.
85
- *
85
+ *
86
86
* @return
87
87
*/
88
88
String getDescription ();
89
89
}
90
90
91
91
/**
92
92
* A {@link FieldFilter} for a given annotation.
93
- *
93
+ *
94
94
* @author Oliver Gierke
95
95
*/
96
96
@ RequiredArgsConstructor
97
97
public static class AnnotationFieldFilter implements DescribedFieldFilter {
98
98
99
99
private final @ NonNull Class <? extends Annotation > annotationType ;
100
100
101
- /*
101
+ /*
102
102
* (non-Javadoc)
103
103
* @see org.springframework.util.ReflectionUtils.FieldFilter#matches(java.lang.reflect.Field)
104
104
*/
105
105
public boolean matches (Field field ) {
106
106
return AnnotationUtils .getAnnotation (field , annotationType ) != null ;
107
107
}
108
108
109
- /*
109
+ /*
110
110
* (non-Javadoc)
111
111
* @see org.springframework.data.util.ReflectionUtils.DescribedFieldFilter#getDescription()
112
112
*/
@@ -117,7 +117,7 @@ public String getDescription() {
117
117
118
118
/**
119
119
* Finds the first field on the given class matching the given {@link FieldFilter}.
120
- *
120
+ *
121
121
* @param type must not be {@literal null}.
122
122
* @param filter must not be {@literal null}.
123
123
* @return the field matching the filter or {@literal null} in case no field could be found.
@@ -140,7 +140,7 @@ public String getDescription() {
140
140
/**
141
141
* Finds the field matching the given {@link DescribedFieldFilter}. Will make sure there's only one field matching the
142
142
* filter.
143
- *
143
+ *
144
144
* @see #findField(Class, DescribedFieldFilter, boolean)
145
145
* @param type must not be {@literal null}.
146
146
* @param filter must not be {@literal null}.
@@ -155,7 +155,7 @@ public static Field findField(Class<?> type, DescribedFieldFilter filter) {
155
155
/**
156
156
* Finds the field matching the given {@link DescribedFieldFilter}. Will make sure there's only one field matching the
157
157
* filter in case {@code enforceUniqueness} is {@literal true}.
158
- *
158
+ *
159
159
* @param type must not be {@literal null}.
160
160
* @param filter must not be {@literal null}.
161
161
* @param enforceUniqueness whether to enforce uniqueness of the field
@@ -198,7 +198,7 @@ public static Field findField(Class<?> type, DescribedFieldFilter filter, boolea
198
198
199
199
/**
200
200
* Finds the field of the given name on the given type.
201
- *
201
+ *
202
202
* @param type must not be {@literal null}.
203
203
* @param name must not be {@literal null} or empty.
204
204
* @return
@@ -217,7 +217,7 @@ public static Field findRequiredField(Class<?> type, String name) {
217
217
218
218
/**
219
219
* Sets the given field on the given object to the given value. Will make sure the given field is accessible.
220
- *
220
+ *
221
221
* @param field must not be {@literal null}.
222
222
* @param target must not be {@literal null}.
223
223
* @param value
@@ -230,7 +230,7 @@ public static void setField(Field field, Object target, @Nullable Object value)
230
230
231
231
/**
232
232
* Finds a constructor on the given type that matches the given constructor arguments.
233
- *
233
+ *
234
234
* @param type must not be {@literal null}.
235
235
* @param constructorArguments must not be {@literal null}.
236
236
* @return a {@link Constructor} that is compatible with the given arguments.
@@ -247,7 +247,7 @@ public static Optional<Constructor<?>> findConstructor(Class<?> type, Object...
247
247
248
248
/**
249
249
* Returns the method with the given name of the given class and parameter types.
250
- *
250
+ *
251
251
* @param type must not be {@literal null}.
252
252
* @param name must not be {@literal null}.
253
253
* @param parameterTypes must not be {@literal null}.
@@ -273,7 +273,7 @@ public static Method findRequiredMethod(Class<?> type, String name, Class<?>...
273
273
274
274
/**
275
275
* Returns a {@link Stream} of the return and parameters types of the given {@link Method}.
276
- *
276
+ *
277
277
* @param method must not be {@literal null}.
278
278
* @return
279
279
* @since 2.0
@@ -290,7 +290,7 @@ public static Stream<Class<?>> returnTypeAndParameters(Method method) {
290
290
291
291
/**
292
292
* Returns the {@link Method} with the given name and parameters declared on the given type, if available.
293
- *
293
+ *
294
294
* @param type must not be {@literal null}.
295
295
* @param name must not be {@literal null} or empty.
296
296
* @param parameterTypes must not be {@literal null}.
0 commit comments