Skip to content

Commit 35dbda7

Browse files
committed
Polishing.
Add assertions, refine Javadoc. Original pull request: #2635. See #2634.
1 parent 02bf260 commit 35dbda7

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/main/java/org/springframework/data/domain/ManagedTypes.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
import java.util.stream.Stream;
2424

2525
import org.springframework.data.util.Lazy;
26+
import org.springframework.util.Assert;
2627

2728
/**
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.
3031
*
3132
* @author Christoph Strobl
3233
* @author John Blum
33-
* @see java.lang.FunctionalInterface
3434
* @since 3.0
3535
*/
3636
@FunctionalInterface
@@ -60,6 +60,8 @@ static ManagedTypes empty() {
6060
* @see #fromSupplier(Supplier)
6161
*/
6262
static ManagedTypes fromIterable(Iterable<? extends Class<?>> types) {
63+
64+
Assert.notNull(types, "Types must not be null");
6365
return types::forEach;
6466
}
6567

@@ -75,6 +77,8 @@ static ManagedTypes fromIterable(Iterable<? extends Class<?>> types) {
7577
* @see #fromSupplier(Supplier)
7678
*/
7779
static ManagedTypes fromStream(Stream<? extends Class<?>> types) {
80+
81+
Assert.notNull(types, "Types must not be null");
7882
return types::forEach;
7983
}
8084

@@ -88,11 +92,13 @@ static ManagedTypes fromStream(Stream<? extends Class<?>> types) {
8892
* {@link Iterable} of {@link Class types}.
8993
* @see java.util.function.Supplier
9094
* @see java.lang.Iterable
91-
* @see #fromIterable(Iterable)
92-
* @see #fromStream(Stream)
95+
* @see #fromIterable(Iterable)
96+
* @see #fromStream(Stream)
9397
*/
9498
static ManagedTypes fromSupplier(Supplier<Iterable<Class<?>>> dataProvider) {
9599

100+
Assert.notNull(dataProvider, "Supplier must not be null");
101+
96102
return new ManagedTypes() {
97103

98104
final Lazy<Iterable<Class<?>>> lazyProvider = Lazy.of(dataProvider);

src/main/java/org/springframework/data/mapping/context/AbstractMappingContext.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
import org.apache.commons.logging.Log;
3535
import org.apache.commons.logging.LogFactory;
36+
3637
import org.springframework.beans.BeanUtils;
3738
import org.springframework.beans.BeansException;
3839
import org.springframework.beans.factory.InitializingBean;
@@ -59,7 +60,6 @@
5960
import org.springframework.data.mapping.model.SimpleTypeHolder;
6061
import org.springframework.data.spel.EvaluationContextProvider;
6162
import org.springframework.data.spel.ExtensionAwareEvaluationContextProvider;
62-
import org.springframework.data.util.ClassTypeInformation;
6363
import org.springframework.data.util.KotlinReflectionUtils;
6464
import org.springframework.data.util.NullableWrapperConverters;
6565
import org.springframework.data.util.Optionals;
@@ -153,7 +153,7 @@ public void setInitialEntitySet(Set<? extends Class<?>> initialEntitySet) {
153153
/**
154154
* Sets the types to populate the context initially.
155155
*
156-
* @param managedTypes must not be {@literal null}. Use {@link ManagedTypes#empty()} instead;
156+
* @param managedTypes must not be {@literal null}. Use {@link ManagedTypes#empty()} instead.
157157
* @since 3.0
158158
*/
159159
public void setManagedTypes(ManagedTypes managedTypes) {

0 commit comments

Comments
 (0)