Modifier and Type | Class and Description |
---|---|
static class |
Publishers.JustPublisher<T>
A publisher for a value.
|
static interface |
Publishers.MapOrSupplyEmpty<T,R>
Maps the next result or supplies an empty result.
|
static interface |
Publishers.MicronautPublisher<T>
Marker interface for any micronaut produced publishers.
|
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> |
empty()
A
Publisher that completes without emitting any items. |
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<?>> |
getKnownCompletableTypes() |
static List<Class<?>> |
getKnownReactiveTypes() |
static List<Class<?>> |
getKnownSingleTypes() |
static boolean |
isCompletable(Class<?> type)
Does the given reactive type emit a single result.
|
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,R> Publisher<R> |
mapOrSupplyEmpty(Publisher<T> publisher,
Publishers.MapOrSupplyEmpty<T,R> mapOrSupplyEmpty)
Map the result from a publisher using the given mapper or supply empty value.
|
static <T> Publisher<T> |
onComplete(Publisher<T> publisher,
Supplier<CompletableFuture<Void>> future)
Allow executing logic on completion of a Publisher.
|
static void |
registerReactiveCompletable(Class<?> type)
Registers an additional reactive completable type.
|
static void |
registerReactiveSingle(Class<?> type)
Registers an additional reactive single type.
|
static void |
registerReactiveType(Class<?> type)
Registers an additional reactive type.
|
static <T> Publisher<T> |
then(Publisher<T> publisher,
Consumer<T> consumer)
Map the result from a publisher using the given mapper.
|
public static void registerReactiveType(Class<?> type)
type
- The typepublic static void registerReactiveSingle(Class<?> type)
type
- The typepublic static void registerReactiveCompletable(Class<?> type)
type
- The typepublic static List<Class<?>> getKnownReactiveTypes()
public static List<Class<?>> getKnownSingleTypes()
public static List<Class<?>> getKnownCompletableTypes()
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> Publisher<T> empty()
Publisher
that completes without emitting any items.T
- The value typePublisher
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,R> Publisher<R> mapOrSupplyEmpty(Publisher<T> publisher, Publishers.MapOrSupplyEmpty<T,R> mapOrSupplyEmpty)
T
- The generic typeR
- The result typepublisher
- The publishermapOrSupplyEmpty
- The mapOrSupplyEmptypublic 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 typepublic static boolean isCompletable(Class<?> type)
type
- The type