Package rx.internal.util
Enum InternalObservableUtils
- java.lang.Object
-
- java.lang.Enum<InternalObservableUtils>
-
- rx.internal.util.InternalObservableUtils
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<InternalObservableUtils>
public enum InternalObservableUtils extends java.lang.Enum<InternalObservableUtils>
Holder of named utility classes factored out from Observable to save source space and help with debugging with properly named objects.
-
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description static InternalObservableUtils.PlusOneFunc2
COUNTER
A BiFunction that expects an integer as its first parameter and returns +1.(package private) static InternalObservableUtils.NotificationErrorExtractor
ERROR_EXTRACTOR
static Action1<java.lang.Throwable>
ERROR_NOT_IMPLEMENTED
Throws an OnErrorNotImplementedException when called.static Observable.Operator<java.lang.Boolean,java.lang.Object>
IS_EMPTY
static InternalObservableUtils.PlusOneLongFunc2
LONG_COUNTER
A BiFunction that expects a long as its first parameter and returns +1.static InternalObservableUtils.ObjectEqualsFunc2
OBJECT_EQUALS
A bifunction comparing two objects via null-safe equals.(package private) static InternalObservableUtils.ReturnsVoidFunc1
RETURNS_VOID
static InternalObservableUtils.ToArrayFunc1
TO_ARRAY
A function that converts a List of Observables into an array of Observables.
-
Constructor Summary
Constructors Modifier Constructor Description private
InternalObservableUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T,R>
Func2<R,T,R>createCollectorCaller(Action2<R,? super T> collector)
Returns a Func2 which calls a collector with its parameters and returns the first (R) parameter.static Func1<Observable<? extends Notification<?>>,Observable<?>>
createRepeatDematerializer(Func1<? super Observable<? extends java.lang.Void>,? extends Observable<?>> notificationHandler)
Returns a function that dematerializes the notification signal from an Observable and calls a notification handler with a null for non-terminal events.static <T,R>
Func1<Observable<T>,Observable<R>>createReplaySelectorAndObserveOn(Func1<? super Observable<T>,? extends Observable<R>> selector, Scheduler scheduler)
Creates a Func1 which calls the selector function with the received argument, applies an observeOn on the result and returns the resulting Observable.static <T> Func0<ConnectableObservable<T>>
createReplaySupplier(Observable<T> source)
Returns a Func0 that supplies the ConnectableObservable returned by calling replay() on the source.static <T> Func0<ConnectableObservable<T>>
createReplaySupplier(Observable<T> source, int bufferSize)
Returns a Func0 that supplies the ConnectableObservable returned by calling a parameterized replay() on the source.static <T> Func0<ConnectableObservable<T>>
createReplaySupplier(Observable<T> source, int bufferSize, long time, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
Returns a Func0 that supplies the ConnectableObservable returned by calling a parameterized replay() on the source.static <T> Func0<ConnectableObservable<T>>
createReplaySupplier(Observable<T> source, long time, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
Returns a Func0 that supplies the ConnectableObservable returned by calling a parameterized replay() on the source.static Func1<Observable<? extends Notification<?>>,Observable<?>>
createRetryDematerializer(Func1<? super Observable<? extends java.lang.Throwable>,? extends Observable<?>> notificationHandler)
Returns a function that dematerializes the notification signal from an Observable and calls a notification handler with the Throwable.static Func1<java.lang.Object,java.lang.Boolean>
equalsWith(java.lang.Object other)
Returns a Func1 that checks if its argument is null-safe equals with the given constant reference.static Func1<java.lang.Object,java.lang.Boolean>
isInstanceOf(java.lang.Class<?> clazz)
Returns a Func1 that checks if its argument is an instance of the supplied class.static InternalObservableUtils
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static InternalObservableUtils[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Field Detail
-
LONG_COUNTER
public static final InternalObservableUtils.PlusOneLongFunc2 LONG_COUNTER
A BiFunction that expects a long as its first parameter and returns +1.
-
OBJECT_EQUALS
public static final InternalObservableUtils.ObjectEqualsFunc2 OBJECT_EQUALS
A bifunction comparing two objects via null-safe equals.
-
TO_ARRAY
public static final InternalObservableUtils.ToArrayFunc1 TO_ARRAY
A function that converts a List of Observables into an array of Observables.
-
RETURNS_VOID
static final InternalObservableUtils.ReturnsVoidFunc1 RETURNS_VOID
-
COUNTER
public static final InternalObservableUtils.PlusOneFunc2 COUNTER
A BiFunction that expects an integer as its first parameter and returns +1.
-
ERROR_EXTRACTOR
static final InternalObservableUtils.NotificationErrorExtractor ERROR_EXTRACTOR
-
ERROR_NOT_IMPLEMENTED
public static final Action1<java.lang.Throwable> ERROR_NOT_IMPLEMENTED
Throws an OnErrorNotImplementedException when called.
-
IS_EMPTY
public static final Observable.Operator<java.lang.Boolean,java.lang.Object> IS_EMPTY
-
-
Method Detail
-
values
public static InternalObservableUtils[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (InternalObservableUtils c : InternalObservableUtils.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static InternalObservableUtils valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
equalsWith
public static Func1<java.lang.Object,java.lang.Boolean> equalsWith(java.lang.Object other)
Returns a Func1 that checks if its argument is null-safe equals with the given constant reference.- Parameters:
other
- the other object to check against (nulls allowed)- Returns:
- the comparison function
-
isInstanceOf
public static Func1<java.lang.Object,java.lang.Boolean> isInstanceOf(java.lang.Class<?> clazz)
Returns a Func1 that checks if its argument is an instance of the supplied class.- Parameters:
clazz
- the class to check against- Returns:
- the comparison function
-
createRepeatDematerializer
public static final Func1<Observable<? extends Notification<?>>,Observable<?>> createRepeatDematerializer(Func1<? super Observable<? extends java.lang.Void>,? extends Observable<?>> notificationHandler)
Returns a function that dematerializes the notification signal from an Observable and calls a notification handler with a null for non-terminal events.- Parameters:
notificationHandler
- the handler to notify with nulls- Returns:
- the Func1 instance
-
createReplaySelectorAndObserveOn
public static <T,R> Func1<Observable<T>,Observable<R>> createReplaySelectorAndObserveOn(Func1<? super Observable<T>,? extends Observable<R>> selector, Scheduler scheduler)
Creates a Func1 which calls the selector function with the received argument, applies an observeOn on the result and returns the resulting Observable.- Type Parameters:
T
- the input value typeR
- the output value type- Parameters:
selector
- the selector functionscheduler
- the scheduler to apply on the output of the selector- Returns:
- the new Func1 instance
-
createRetryDematerializer
public static final Func1<Observable<? extends Notification<?>>,Observable<?>> createRetryDematerializer(Func1<? super Observable<? extends java.lang.Throwable>,? extends Observable<?>> notificationHandler)
Returns a function that dematerializes the notification signal from an Observable and calls a notification handler with the Throwable.- Parameters:
notificationHandler
- the handler to notify with Throwables- Returns:
- the Func1 instance
-
createReplaySupplier
public static <T> Func0<ConnectableObservable<T>> createReplaySupplier(Observable<T> source)
Returns a Func0 that supplies the ConnectableObservable returned by calling replay() on the source.- Type Parameters:
T
- the input value type- Parameters:
source
- the source to call replay on by the supplier function- Returns:
- the new Func0 instance
-
createReplaySupplier
public static <T> Func0<ConnectableObservable<T>> createReplaySupplier(Observable<T> source, int bufferSize)
Returns a Func0 that supplies the ConnectableObservable returned by calling a parameterized replay() on the source.- Type Parameters:
T
- the input value type- Parameters:
source
- the source to call replay on by the supplier functionbufferSize
- the buffer size that limits the number of items the connectable observable can replay- Returns:
- the new Func0 instance
-
createReplaySupplier
public static <T> Func0<ConnectableObservable<T>> createReplaySupplier(Observable<T> source, long time, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
Returns a Func0 that supplies the ConnectableObservable returned by calling a parameterized replay() on the source.- Type Parameters:
T
- the input value type- Parameters:
source
- the source to call replay on by the supplier functiontime
- the duration of the window in which the replayed items must have been emittedunit
- the time unit oftime
scheduler
- the scheduler to use for timing information- Returns:
- the new Func0 instance
-
createReplaySupplier
public static <T> Func0<ConnectableObservable<T>> createReplaySupplier(Observable<T> source, int bufferSize, long time, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
Returns a Func0 that supplies the ConnectableObservable returned by calling a parameterized replay() on the source.- Type Parameters:
T
- the input value type- Parameters:
source
- the source to call replay on by the supplier functionbufferSize
- the buffer size that limits the number of items the connectable observable can replaytime
- the duration of the window in which the replayed items must have been emittedunit
- the time unit oftime
scheduler
- the scheduler to use for timing information- Returns:
- the new Func0 instance
-
createCollectorCaller
public static <T,R> Func2<R,T,R> createCollectorCaller(Action2<R,? super T> collector)
Returns a Func2 which calls a collector with its parameters and returns the first (R) parameter.- Type Parameters:
T
- the input value typeR
- the result value type- Parameters:
collector
- the collector action to call- Returns:
- the new Func2 instance
-
-