@@ -18,6 +18,7 @@ class ReflectionConfigDsl {
1818 private val packages = mutableListOf<String >()
1919 private val scanners = mutableListOf<Scanners >()
2020 private val urls = mutableListOf<URL >()
21+ private var inputsFilter: (String ) -> Boolean = { true }
2122 private val classLoaders = mutableListOf<ClassLoader >()
2223 private var parallel = false
2324 private var shouldExpandSuperTypes = true
@@ -55,6 +56,17 @@ class ReflectionConfigDsl {
5556 return this
5657 }
5758
59+ /* *
60+ * Sets a filter for input names.
61+ *
62+ * @param filter A lambda function that takes a [String] and returns a [Boolean], indicating whether the input should be included.
63+ * @return The current instance of [ReflectionConfigDsl] for method chaining.
64+ */
65+ fun filterInputsBy (filter : (String ) -> Boolean ): ReflectionConfigDsl {
66+ inputsFilter = filter
67+ return this
68+ }
69+
5870 /* *
5971 * Adds class loaders to the configuration.
6072 *
@@ -89,11 +101,13 @@ class ReflectionConfigDsl {
89101
90102 /* *
91103 * Builds a [ConfigurationBuilder] based on the current configuration.
104+ *
105+ * @return A [ConfigurationBuilder] configured with the specified packages, scanners, URLs, filters, and class loaders.
92106 */
93107 fun build (): ConfigurationBuilder = ConfigurationBuilder ()
94108 .forPackages(* packages.toTypedArray())
95109 .addUrls(* urls.toTypedArray())
96- .filterInputsBy { it.contains( " com.lambda " ) }
110+ .filterInputsBy(inputsFilter)
97111 .addClassLoaders(* classLoaders.toTypedArray())
98112 .setExpandSuperTypes(shouldExpandSuperTypes)
99113}
0 commit comments