You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2026/04/26 15:03:46 UTC
(groovy) branch master updated: Add missing Javadoc for groovy-reactor and groovy-rxjava
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new b0c3f357bc Add missing Javadoc for groovy-reactor and groovy-rxjava
b0c3f357bc is described below
commit b0c3f357bca2745689afea4391b9d9c1ec9a7ca3
Author: Daniel Sun <su...@apache.org>
AuthorDate: Mon Apr 27 00:03:31 2026 +0900
Add missing Javadoc for groovy-reactor and groovy-rxjava
---
.../groovy/reactor/ReactorAwaitableAdapter.java | 30 +++++++++++++++++++
.../groovy/rxjava/RxJavaAwaitableAdapter.java | 34 ++++++++++++++++++++++
2 files changed, 64 insertions(+)
diff --git a/subprojects/groovy-reactor/src/main/java/org/apache/groovy/reactor/ReactorAwaitableAdapter.java b/subprojects/groovy-reactor/src/main/java/org/apache/groovy/reactor/ReactorAwaitableAdapter.java
index dbd4b6194c..512b4620fa 100644
--- a/subprojects/groovy-reactor/src/main/java/org/apache/groovy/reactor/ReactorAwaitableAdapter.java
+++ b/subprojects/groovy-reactor/src/main/java/org/apache/groovy/reactor/ReactorAwaitableAdapter.java
@@ -38,11 +38,26 @@ import reactor.core.publisher.Mono;
*/
public class ReactorAwaitableAdapter implements AwaitableAdapter {
+ /**
+ * Returns whether the supplied type can be awaited as a Reactor single-result source.
+ *
+ * @param type candidate type to inspect
+ * @return {@code true} if {@code type} is a {@link Mono} or one of its subtypes
+ */
@Override
public boolean supportsAwaitable(Class<?> type) {
return Mono.class.isAssignableFrom(type);
}
+ /**
+ * Converts a {@link Mono} into an {@link Awaitable} backed by the mono's
+ * {@linkplain Mono#toFuture() future view}.
+ *
+ * @param source source object to adapt
+ * @param <T> awaited value type
+ * @return awaitable representation of the supplied {@link Mono}
+ * @throws IllegalArgumentException if {@code source} is not a {@link Mono}
+ */
@Override
@SuppressWarnings("unchecked")
public <T> Awaitable<T> toAwaitable(Object source) {
@@ -52,11 +67,26 @@ public class ReactorAwaitableAdapter implements AwaitableAdapter {
throw new IllegalArgumentException("Cannot convert to Awaitable: " + source.getClass());
}
+ /**
+ * Returns whether the supplied type can be exposed as an iterable Reactor multi-result source.
+ *
+ * @param type candidate type to inspect
+ * @return {@code true} if {@code type} is a {@link Flux} or one of its subtypes
+ */
@Override
public boolean supportsIterable(Class<?> type) {
return Flux.class.isAssignableFrom(type);
}
+ /**
+ * Converts a {@link Flux} into a blocking {@link Iterable} suitable for
+ * {@code for await} consumption.
+ *
+ * @param source source object to adapt
+ * @param <T> iterated element type
+ * @return iterable view of the supplied {@link Flux}
+ * @throws IllegalArgumentException if {@code source} is not a {@link Flux}
+ */
@Override
@SuppressWarnings("unchecked")
public <T> Iterable<T> toIterable(Object source) {
diff --git a/subprojects/groovy-rxjava/src/main/java/org/apache/groovy/rxjava/RxJavaAwaitableAdapter.java b/subprojects/groovy-rxjava/src/main/java/org/apache/groovy/rxjava/RxJavaAwaitableAdapter.java
index 0cf208caaf..e90a20c3ba 100644
--- a/subprojects/groovy-rxjava/src/main/java/org/apache/groovy/rxjava/RxJavaAwaitableAdapter.java
+++ b/subprojects/groovy-rxjava/src/main/java/org/apache/groovy/rxjava/RxJavaAwaitableAdapter.java
@@ -46,6 +46,13 @@ import java.util.concurrent.CompletableFuture;
*/
public class RxJavaAwaitableAdapter implements AwaitableAdapter {
+ /**
+ * Returns whether the supplied type can be awaited as an RxJava single-result source.
+ *
+ * @param type candidate type to inspect
+ * @return {@code true} if {@code type} is a {@link Single}, {@link Maybe},
+ * {@link Completable}, or one of their subtypes
+ */
@Override
public boolean supportsAwaitable(Class<?> type) {
return Single.class.isAssignableFrom(type)
@@ -53,6 +60,17 @@ public class RxJavaAwaitableAdapter implements AwaitableAdapter {
|| Completable.class.isAssignableFrom(type);
}
+ /**
+ * Converts supported RxJava single-result sources into an {@link Awaitable}.
+ * A {@link Single} yields its item, a {@link Maybe} yields its item or
+ * {@code null} when empty, and a {@link Completable} completes with
+ * {@code null}.
+ *
+ * @param source source object to adapt
+ * @param <T> awaited value type
+ * @return awaitable representation of the supplied source
+ * @throws IllegalArgumentException if {@code source} is not a supported RxJava type
+ */
@Override
@SuppressWarnings("unchecked")
public <T> Awaitable<T> toAwaitable(Object source) {
@@ -71,12 +89,28 @@ public class RxJavaAwaitableAdapter implements AwaitableAdapter {
throw new IllegalArgumentException("Cannot convert to Awaitable: " + source.getClass());
}
+ /**
+ * Returns whether the supplied type can be exposed as an iterable RxJava multi-result source.
+ *
+ * @param type candidate type to inspect
+ * @return {@code true} if {@code type} is an {@link Observable},
+ * {@link Flowable}, or one of their subtypes
+ */
@Override
public boolean supportsIterable(Class<?> type) {
return Observable.class.isAssignableFrom(type)
|| Flowable.class.isAssignableFrom(type);
}
+ /**
+ * Converts supported RxJava multi-result sources into blocking iterables
+ * suitable for {@code for await} consumption.
+ *
+ * @param source source object to adapt
+ * @param <T> iterated element type
+ * @return iterable representation of the supplied {@link Observable} or {@link Flowable}
+ * @throws IllegalArgumentException if {@code source} is not a supported RxJava type
+ */
@Override
@SuppressWarnings("unchecked")
public <T> Iterable<T> toIterable(Object source) {