Class ObservableConverter
- java.lang.Object
-
- io.smallrye.reactive.converters.rxjava2.ObservableConverter
-
- All Implemented Interfaces:
ReactiveTypeConverter<io.reactivex.Observable>
public class ObservableConverter extends Object implements ReactiveTypeConverter<io.reactivex.Observable>
Converter handling the RX Java 2Observabletype. toCompletionStage
ThetoCompletionStage(Observable)method returns aCompletionStageinstance completed or failed according to the stream emissions. The returnedCompletionStageis redeemed either the first emitted value ornullto distinguish stream emitting values from empty streams. If the stream is empty, the returnedCompletionStageis completed withnull. If the stream emits multiple values, the first one is used, and theCompletionStageis completed with an instance of the first emitted item. Other items and potential error are ignored. If the stream fails before emitting a first item, theCompletionStageis completed with the failure. fromCompletionStage
ThefromCompletionStage(CompletionStage)method returns aObservableinstance completed or failed according to the passedCompletionStagecompletion. Note that if the future emits anullvalue, theObservablefails. If the future completes with a value, the observable emits the value and then completes. If the future completes with a failure, the stream emits the failure. fromPublisher
ThefromPublisher(Publisher)method returns aObservableemitting the same items, failure and completion as the passedPublisher. If the passedPublisheris empty, the returnedObservableis also empty. The sourcePublisheris consumed in an unbounded fashion without applying any back-pressure to it. This is because ofObservable.fromPublisher(Publisher)used by this method. toRSPublisher
ThetoRSPublisher(Observable)method returns aPublisheremitting the same events as the sourceObservable. This operations applies the amissingback-pressure strategy.OnNextevents are written without any buffering or dropping. The consumer of the returnedPublisherhas to deal with any overflow.
-
-
Constructor Summary
Constructors Constructor Description ObservableConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanemitAtMostOneItem()booleanemitItems()<X> io.reactivex.ObservablefromCompletionStage(CompletionStage<X> cs)io.reactivex.ObservablefromPublisher(org.reactivestreams.Publisher publisher)booleansupportNullValue()<T> CompletionStage<T>toCompletionStage(io.reactivex.Observable instance)<T> org.reactivestreams.Publisher<T>toRSPublisher(io.reactivex.Observable instance)Class<io.reactivex.Observable>type()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.smallrye.reactive.converters.ReactiveTypeConverter
requireAtLeastOneItem
-
-
-
-
Method Detail
-
toRSPublisher
public <T> org.reactivestreams.Publisher<T> toRSPublisher(io.reactivex.Observable instance)
- Specified by:
toRSPublisherin interfaceReactiveTypeConverter<io.reactivex.Observable>
-
fromPublisher
public io.reactivex.Observable fromPublisher(org.reactivestreams.Publisher publisher)
- Specified by:
fromPublisherin interfaceReactiveTypeConverter<io.reactivex.Observable>
-
toCompletionStage
public <T> CompletionStage<T> toCompletionStage(io.reactivex.Observable instance)
- Specified by:
toCompletionStagein interfaceReactiveTypeConverter<io.reactivex.Observable>
-
fromCompletionStage
public <X> io.reactivex.Observable fromCompletionStage(CompletionStage<X> cs)
- Specified by:
fromCompletionStagein interfaceReactiveTypeConverter<io.reactivex.Observable>
-
type
public Class<io.reactivex.Observable> type()
- Specified by:
typein interfaceReactiveTypeConverter<io.reactivex.Observable>
-
emitItems
public boolean emitItems()
- Specified by:
emitItemsin interfaceReactiveTypeConverter<io.reactivex.Observable>
-
emitAtMostOneItem
public boolean emitAtMostOneItem()
- Specified by:
emitAtMostOneItemin interfaceReactiveTypeConverter<io.reactivex.Observable>
-
supportNullValue
public boolean supportNullValue()
- Specified by:
supportNullValuein interfaceReactiveTypeConverter<io.reactivex.Observable>
-
-