Polishing

This commit is contained in:
Juergen Hoeller
2024-01-24 22:30:33 +01:00
parent c5a75219ce
commit c6121da151
3 changed files with 17 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,8 +32,13 @@ import org.springframework.lang.Nullable;
*/
abstract class CoroutinesUtils {
static Object asFlow(Object publisher) {
return ReactiveFlowKt.asFlow((Publisher<?>) publisher);
static Object asFlow(@Nullable Object publisher) {
if (publisher instanceof Publisher<?> rsPublisher) {
return ReactiveFlowKt.asFlow(rsPublisher);
}
else {
throw new IllegalArgumentException("Not a Reactive Streams Publisher: " + publisher);
}
}
@Nullable