23
23
import java .util .stream .Stream ;
24
24
25
25
import org .springframework .data .util .Lazy ;
26
+ import org .springframework .util .Assert ;
26
27
27
28
/**
28
- * Types managed by a Spring Data implementation. Used to predefine a set of know entities that might need processing
29
- * during the Spring container, Spring Data Repository initialization phase.
29
+ * Types managed by a Spring Data implementation. Used to predefine a set of known entities that might need processing
30
+ * during the initialization phase.
30
31
*
31
32
* @author Christoph Strobl
32
33
* @author John Blum
33
- * @see java.lang.FunctionalInterface
34
34
* @since 3.0
35
35
*/
36
36
@ FunctionalInterface
@@ -60,6 +60,8 @@ static ManagedTypes empty() {
60
60
* @see #fromSupplier(Supplier)
61
61
*/
62
62
static ManagedTypes fromIterable (Iterable <? extends Class <?>> types ) {
63
+
64
+ Assert .notNull (types , "Types must not be null" );
63
65
return types ::forEach ;
64
66
}
65
67
@@ -75,6 +77,8 @@ static ManagedTypes fromIterable(Iterable<? extends Class<?>> types) {
75
77
* @see #fromSupplier(Supplier)
76
78
*/
77
79
static ManagedTypes fromStream (Stream <? extends Class <?>> types ) {
80
+
81
+ Assert .notNull (types , "Types must not be null" );
78
82
return types ::forEach ;
79
83
}
80
84
@@ -88,11 +92,13 @@ static ManagedTypes fromStream(Stream<? extends Class<?>> types) {
88
92
* {@link Iterable} of {@link Class types}.
89
93
* @see java.util.function.Supplier
90
94
* @see java.lang.Iterable
91
- * @see #fromIterable(Iterable)
92
- * @see #fromStream(Stream)
95
+ * @see #fromIterable(Iterable)
96
+ * @see #fromStream(Stream)
93
97
*/
94
98
static ManagedTypes fromSupplier (Supplier <Iterable <Class <?>>> dataProvider ) {
95
99
100
+ Assert .notNull (dataProvider , "Supplier must not be null" );
101
+
96
102
return new ManagedTypes () {
97
103
98
104
final Lazy <Iterable <Class <?>>> lazyProvider = Lazy .of (dataProvider );
0 commit comments