Class RxEventSources


  • public final class RxEventSources
    extends java.lang.Object
    Contains utility methods for converting back and forth between Observables and EventSources.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <E> com.spotify.mobius.EventSource<E> fromObservables​(rx.Observable<E>... observables)
      Create an event source from the given RxJava streams.
      static <E> rx.Observable<E> toObservable​(com.spotify.mobius.EventSource<E> eventSource, rx.Emitter.BackpressureMode backpressureMode)
      Create an observable from the given event source.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • fromObservables

        @SafeVarargs
        public static <E> com.spotify.mobius.EventSource<E> fromObservables​(rx.Observable<E>... observables)
        Create an event source from the given RxJava streams.

        All streams must be mapped to your event type.

        Type Parameters:
        E - the event type
        Parameters:
        observables - the observables you want to include in this event source
        Returns:
        an EventSource based on the provided observables
      • toObservable

        public static <E> rx.Observable<E> toObservable​(com.spotify.mobius.EventSource<E> eventSource,
                                                        rx.Emitter.BackpressureMode backpressureMode)
        Create an observable from the given event source.
        Type Parameters:
        E - the event type
        Parameters:
        eventSource - the eventSource you want to convert to an observable
        Returns:
        an Observable based on the provided event source