@@ -67,7 +67,6 @@ private ReflectionSupport() {
67
67
*/
68
68
@ API (status = DEPRECATED , since = "1.4" )
69
69
@ Deprecated
70
- @ SuppressWarnings ("deprecation" )
71
70
public static Optional <Class <?>> loadClass (String name ) {
72
71
return ReflectionUtils .loadClass (name );
73
72
}
@@ -137,6 +136,28 @@ public static List<Class<?>> findAllClassesInClasspathRoot(URI root, Predicate<C
137
136
return ReflectionUtils .findAllClassesInClasspathRoot (root , classFilter , classNameFilter );
138
137
}
139
138
139
+ /**
140
+ * Find all {@linkplain Resource resources} in the supplied classpath {@code root}
141
+ * that match the specified {@code resourceFilter} predicate.
142
+ *
143
+ * <p>The classpath scanning algorithm searches recursively in subpackages
144
+ * beginning with the root of the classpath.
145
+ *
146
+ * @param root the URI for the classpath root in which to scan; never
147
+ * {@code null}
148
+ * @param resourceFilter the resource type filter; never {@code null}
149
+ * @return an immutable list of all such resources found; never {@code null}
150
+ * but potentially empty
151
+ * @since 1.11
152
+ * @see #findAllResourcesInPackage(String, Predicate)
153
+ * @see #findAllResourcesInModule(String, Predicate)
154
+ */
155
+ @ API (status = EXPERIMENTAL , since = "1.11" )
156
+ public static List <Resource > findAllResourcesInClasspathRoot (URI root , Predicate <Resource > resourceFilter ) {
157
+
158
+ return ReflectionUtils .findAllResourcesInClasspathRoot (root , resourceFilter );
159
+ }
160
+
140
161
/**
141
162
* Find all {@linkplain Class classes} in the supplied classpath {@code root}
142
163
* that match the specified {@code classFilter} and {@code classNameFilter}
@@ -162,6 +183,28 @@ public static Stream<Class<?>> streamAllClassesInClasspathRoot(URI root, Predica
162
183
return ReflectionUtils .streamAllClassesInClasspathRoot (root , classFilter , classNameFilter );
163
184
}
164
185
186
+ /**
187
+ * Find all {@linkplain Resource resources} in the supplied classpath {@code root}
188
+ * that match the specified {@code resourceFilter} predicate.
189
+ *
190
+ * <p>The classpath scanning algorithm searches recursively in subpackages
191
+ * beginning with the root of the classpath.
192
+ *
193
+ * @param root the URI for the classpath root in which to scan; never
194
+ * {@code null}
195
+ * @param resourceFilter the resource type filter; never {@code null}
196
+ * @return a stream of all such classes found; never {@code null}
197
+ * but potentially empty
198
+ * @since 1.11
199
+ * @see #streamAllResourcesInPackage(String, Predicate)
200
+ * @see #streamAllResourcesInModule(String, Predicate)
201
+ */
202
+ @ API (status = EXPERIMENTAL , since = "1.11" )
203
+ public static Stream <Resource > streamAllResourcesInClasspathRoot (URI root , Predicate <Resource > resourceFilter ) {
204
+
205
+ return ReflectionUtils .streamAllResourcesInClasspathRoot (root , resourceFilter );
206
+ }
207
+
165
208
/**
166
209
* Find all {@linkplain Class classes} in the supplied {@code basePackageName}
167
210
* that match the specified {@code classFilter} and {@code classNameFilter}
@@ -186,6 +229,29 @@ public static List<Class<?>> findAllClassesInPackage(String basePackageName, Pre
186
229
return ReflectionUtils .findAllClassesInPackage (basePackageName , classFilter , classNameFilter );
187
230
}
188
231
232
+ /**
233
+ * Find all {@linkplain Resource resources} in the supplied {@code basePackageName}
234
+ * that match the specified {@code resourceFilter} predicate.
235
+ *
236
+ * <p>The classpath scanning algorithm searches recursively in subpackages
237
+ * beginning within the supplied base package.
238
+ *
239
+ * @param basePackageName the name of the base package in which to start
240
+ * scanning; must not be {@code null} and must be valid in terms of Java
241
+ * syntax
242
+ * @param resourceFilter the resource type filter; never {@code null}
243
+ * @return an immutable list of all such classes found; never {@code null}
244
+ * but potentially empty
245
+ * @since 1.11
246
+ * @see #findAllResourcesInClasspathRoot(URI, Predicate)
247
+ * @see #findAllResourcesInModule(String, Predicate)
248
+ */
249
+ @ API (status = EXPERIMENTAL , since = "1.11" )
250
+ public static List <Resource > findAllResourcesInPackage (String basePackageName , Predicate <Resource > resourceFilter ) {
251
+
252
+ return ReflectionUtils .findAllResourcesInPackage (basePackageName , resourceFilter );
253
+ }
254
+
189
255
/**
190
256
* Find all {@linkplain Class classes} in the supplied {@code basePackageName}
191
257
* that match the specified {@code classFilter} and {@code classNameFilter}
@@ -212,6 +278,30 @@ public static Stream<Class<?>> streamAllClassesInPackage(String basePackageName,
212
278
return ReflectionUtils .streamAllClassesInPackage (basePackageName , classFilter , classNameFilter );
213
279
}
214
280
281
+ /**
282
+ * Find all {@linkplain Resource resources} in the supplied {@code basePackageName}
283
+ * that match the specified {@code resourceFilter} predicate.
284
+ *
285
+ * <p>The classpath scanning algorithm searches recursively in subpackages
286
+ * beginning within the supplied base package.
287
+ *
288
+ * @param basePackageName the name of the base package in which to start
289
+ * scanning; must not be {@code null} and must be valid in terms of Java
290
+ * syntax
291
+ * @param resourceFilter the resource type filter; never {@code null}
292
+ * @return a stream of all such resources found; never {@code null}
293
+ * but potentially empty
294
+ * @since 1.11
295
+ * @see #streamAllResourcesInClasspathRoot(URI, Predicate)
296
+ * @see #streamAllResourcesInModule(String, Predicate)
297
+ */
298
+ @ API (status = EXPERIMENTAL , since = "1.11" )
299
+ public static Stream <Resource > streamAllResourcesInPackage (String basePackageName ,
300
+ Predicate <Resource > resourceFilter ) {
301
+
302
+ return ReflectionUtils .streamAllResourcesInPackage (basePackageName , resourceFilter );
303
+ }
304
+
215
305
/**
216
306
* Find all {@linkplain Class classes} in the supplied {@code moduleName}
217
307
* that match the specified {@code classFilter} and {@code classNameFilter}
@@ -236,6 +326,28 @@ public static List<Class<?>> findAllClassesInModule(String moduleName, Predicate
236
326
return ReflectionUtils .findAllClassesInModule (moduleName , classFilter , classNameFilter );
237
327
}
238
328
329
+ /**
330
+ * Find all {@linkplain Resource resources} in the supplied {@code moduleName}
331
+ * that match the specified {@code resourceFilter} predicate.
332
+ *
333
+ * <p>The module-path scanning algorithm searches recursively in all
334
+ * packages contained in the module.
335
+ *
336
+ * @param moduleName the name of the module to scan; never {@code null} or
337
+ * <em>empty</em>
338
+ * @param resourceFilter the resource type filter; never {@code null}
339
+ * @return an immutable list of all such resources found; never {@code null}
340
+ * but potentially empty
341
+ * @since 1.11
342
+ * @see #findAllResourcesInClasspathRoot(URI, Predicate)
343
+ * @see #findAllResourcesInPackage(String, Predicate)
344
+ */
345
+ @ API (status = EXPERIMENTAL , since = "1.11" )
346
+ public static List <Resource > findAllResourcesInModule (String moduleName , Predicate <Resource > resourceFilter ) {
347
+
348
+ return ReflectionUtils .findAllResourcesInModule (moduleName , resourceFilter );
349
+ }
350
+
239
351
/**
240
352
* Find all {@linkplain Class classes} in the supplied {@code moduleName}
241
353
* that match the specified {@code classFilter} and {@code classNameFilter}
@@ -261,6 +373,28 @@ public static Stream<Class<?>> streamAllClassesInModule(String moduleName, Predi
261
373
return ReflectionUtils .streamAllClassesInModule (moduleName , classFilter , classNameFilter );
262
374
}
263
375
376
+ /**
377
+ * Find all {@linkplain Resource resources} in the supplied {@code moduleName}
378
+ * that match the specified {@code resourceFilter} predicate.
379
+ *
380
+ * <p>The module-path scanning algorithm searches recursively in all
381
+ * packages contained in the module.
382
+ *
383
+ * @param moduleName the name of the module to scan; never {@code null} or
384
+ * <em>empty</em>
385
+ * @param resourceFilter the resource type filter; never {@code null}
386
+ * @return a stream of all such resources found; never {@code null}
387
+ * but potentially empty
388
+ * @since 1.11
389
+ * @see #streamAllResourcesInClasspathRoot(URI, Predicate)
390
+ * @see #streamAllResourcesInPackage(String, Predicate)
391
+ */
392
+ @ API (status = EXPERIMENTAL , since = "1.11" )
393
+ public static Stream <Resource > streamAllResourcesInModule (String moduleName , Predicate <Resource > resourceFilter ) {
394
+
395
+ return ReflectionUtils .streamAllResourcesInModule (moduleName , resourceFilter );
396
+ }
397
+
264
398
/**
265
399
* Create a new instance of the specified {@link Class} by invoking
266
400
* the constructor whose argument list matches the types of the supplied
0 commit comments