Constructor and Description |
---|
Publishers() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
convertPublisher(Object object,
Class<T> publisherType)
Attempts to convert the publisher to the given type.
|
static <T> Publisher<T> |
fromCompletableFuture(CompletableFuture<T> future)
Build a
Publisher from a CompletableFuture . |
static <T> Publisher<T> |
fromCompletableFuture(Supplier<CompletableFuture<T>> futureSupplier)
Build a
Publisher from a CompletableFuture . |
static List<Class<?>> |
getKnownReactiveTypes() |
static boolean |
isConvertibleToPublisher(Class<?> type)
Is the given type a Publisher or convertible to a publisher.
|
static boolean |
isConvertibleToPublisher(Object object)
Is the given object a Publisher or convertible to a publisher.
|
static boolean |
isSingle(Class<?> type)
Does the given reactive type emit a single result.
|
static <T> Publisher<T> |
just(T value)
A
Publisher that emits a fixed single value. |
static <T> Publisher<T> |
just(Throwable error)
A
Publisher that emits a fixed single value. |
static <T,R> Publisher<R> |
map(Publisher<T> publisher,
Function<T,R> mapper)
Map the result from a publisher using the given mapper.
|
static <T> Publisher<T> |
onComplete(Publisher<T> publisher,
Supplier<CompletableFuture<Void>> future)
Allow executing logic on completion of a Publisher.
|
static <T> Publisher<T> |
then(Publisher<T> publisher,
Consumer<T> consumer)
Map the result from a publisher using the given mapper.
|
public static List<Class<?>> getKnownReactiveTypes()
public static <T> Publisher<T> fromCompletableFuture(Supplier<CompletableFuture<T>> futureSupplier)
Publisher
from a CompletableFuture
.T
- The type of the publisherfutureSupplier
- The supplier of the CompletableFuture
Publisher
public static <T> Publisher<T> fromCompletableFuture(CompletableFuture<T> future)
Publisher
from a CompletableFuture
.T
- The type of the publisherfuture
- The CompletableFuture
Publisher
public static <T> Publisher<T> just(T value)
Publisher
that emits a fixed single value.T
- The value typevalue
- The value to emitPublisher
public static <T> Publisher<T> just(Throwable error)
Publisher
that emits a fixed single value.T
- The value typeerror
- The error to emitPublisher
public static <T,R> Publisher<R> map(Publisher<T> publisher, Function<T,R> mapper)
T
- The generic typeR
- The result typepublisher
- The publishermapper
- The mapperpublic static <T> Publisher<T> then(Publisher<T> publisher, Consumer<T> consumer)
T
- The generic typepublisher
- The publisherconsumer
- The mapperpublic static <T> Publisher<T> onComplete(Publisher<T> publisher, Supplier<CompletableFuture<Void>> future)
T
- The generic typepublisher
- The publisherfuture
- The runnablepublic static boolean isConvertibleToPublisher(Class<?> type)
type
- The type to checkpublic static boolean isConvertibleToPublisher(Object object)
object
- The objectpublic static <T> T convertPublisher(Object object, Class<T> publisherType)
T
- The generic typeobject
- The object to convertpublisherType
- The publisher typepublic static boolean isSingle(Class<?> type)
type
- The type