public class MaybeHelper extends Object
| Constructor and Description |
|---|
MaybeHelper() |
| Modifier and Type | Method and Description |
|---|---|
static <T> io.reactivex.rxjava3.core.MaybeObserver<T> |
nullObserver() |
static <T> io.vertx.core.Future<T> |
toFuture(io.reactivex.rxjava3.core.Maybe<T> maybe)
Adapts an RxJava2
Maybe<T> to a Vert.x Future. |
static <T,U> io.vertx.core.Future<U> |
toFuture(io.reactivex.rxjava3.core.Maybe<T> maybe,
Function<T,U> adapter)
Like
toFuture(Maybe) but with an adapter of the result. |
static <T> io.reactivex.rxjava3.core.Maybe<T> |
toMaybe(Consumer<io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>> handler)
Returns a
Maybe that, when subscribed, uses the provided handler to adapt a callback-based asynchronous method. |
static <T> io.reactivex.rxjava3.core.MaybeObserver<T> |
toObserver(io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> handler)
Adapts an Vert.x
Handler<AsyncResult<T>> to an RxJava2 MaybeObserver. |
static <T> io.reactivex.rxjava3.core.MaybeTransformer<io.vertx.core.buffer.Buffer,T> |
unmarshaller(Class<T> mappedType) |
static <T> io.reactivex.rxjava3.core.MaybeTransformer<io.vertx.core.buffer.Buffer,T> |
unmarshaller(Class<T> mappedType,
com.fasterxml.jackson.core.ObjectCodec mapper) |
static <T> io.reactivex.rxjava3.core.MaybeTransformer<io.vertx.core.buffer.Buffer,T> |
unmarshaller(com.fasterxml.jackson.core.type.TypeReference<T> mappedTypeRef) |
static <T> io.reactivex.rxjava3.core.MaybeTransformer<io.vertx.core.buffer.Buffer,T> |
unmarshaller(com.fasterxml.jackson.core.type.TypeReference<T> mappedTypeRef,
com.fasterxml.jackson.core.ObjectCodec mapper) |
public static <T> io.reactivex.rxjava3.core.MaybeObserver<T> nullObserver()
MaybeObserver that does nothingpublic static <T> io.reactivex.rxjava3.core.Maybe<T> toMaybe(Consumer<io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>> handler)
Maybe that, when subscribed, uses the provided handler to adapt a callback-based asynchronous method.
For example:
io.vertx.core.Vertx vertx = Vertx.vertx();
Maybe<String> blockingMethodResult = MaybeHelper.toMaybe(handler -> vertx.<String>executeBlocking(fut -> fut.complete(invokeBlocking()), handler));
This is useful when using RxJava without the Vert.x Rxified API or your own asynchronous methods.
handler - the code executed when the returned Maybe is subscribedpublic static <T> io.reactivex.rxjava3.core.MaybeObserver<T> toObserver(io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> handler)
Handler<AsyncResult<T>> to an RxJava2 MaybeObserver.
The returned observer can be subscribed to an Maybe.subscribe(MaybeObserver).
handler - the handler to adaptpublic static <T> io.vertx.core.Future<T> toFuture(io.reactivex.rxjava3.core.Maybe<T> maybe)
Maybe<T> to a Vert.x Future.
The maybe will be immediately subscribed and the returned future will be updated with the result of the single.
maybe - the single to adaptpublic static <T,U> io.vertx.core.Future<U> toFuture(io.reactivex.rxjava3.core.Maybe<T> maybe,
Function<T,U> adapter)
toFuture(Maybe) but with an adapter of the result.public static <T> io.reactivex.rxjava3.core.MaybeTransformer<io.vertx.core.buffer.Buffer,T> unmarshaller(Class<T> mappedType)
public static <T> io.reactivex.rxjava3.core.MaybeTransformer<io.vertx.core.buffer.Buffer,T> unmarshaller(com.fasterxml.jackson.core.type.TypeReference<T> mappedTypeRef)
public static <T> io.reactivex.rxjava3.core.MaybeTransformer<io.vertx.core.buffer.Buffer,T> unmarshaller(Class<T> mappedType, com.fasterxml.jackson.core.ObjectCodec mapper)
public static <T> io.reactivex.rxjava3.core.MaybeTransformer<io.vertx.core.buffer.Buffer,T> unmarshaller(com.fasterxml.jackson.core.type.TypeReference<T> mappedTypeRef,
com.fasterxml.jackson.core.ObjectCodec mapper)
Copyright © 2024 Eclipse. All rights reserved.