Package rx.internal.util
Enum Class InternalObservableUtils
- All Implemented Interfaces:
Serializable
,Comparable<InternalObservableUtils>
,Constable
Holder of named utility classes factored out from Observable to save
source space and help with debugging with properly named objects.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class
(package private) static final class
(package private) static final class
(package private) static final class
(package private) static final class
(package private) static final class
(package private) static final class
(package private) static final class
(package private) static final class
(package private) static final class
(package private) static final class
(package private) static final class
(package private) static final class
(package private) static final class
(package private) static final class
(package private) static final class
(package private) static final class
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final InternalObservableUtils.PlusOneFunc2
A BiFunction that expects an integer as its first parameter and returns +1.(package private) static final InternalObservableUtils.NotificationErrorExtractor
Throws an OnErrorNotImplementedException when called.static final Observable.Operator
<Boolean, Object> static final InternalObservableUtils.PlusOneLongFunc2
A BiFunction that expects a long as its first parameter and returns +1.static final InternalObservableUtils.ObjectEqualsFunc2
A bifunction comparing two objects via null-safe equals.(package private) static final InternalObservableUtils.ReturnsVoidFunc1
static final InternalObservableUtils.ToArrayFunc1
A function that converts a List of Observables into an array of Observables. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <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 final Func1
<Observable<? extends Notification<?>>, Observable<?>> createRepeatDematerializer
(Func1<? super Observable<? extends 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, 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, TimeUnit unit, Scheduler scheduler) Returns a Func0 that supplies the ConnectableObservable returned by calling a parameterized replay() on the source.static final Func1
<Observable<? extends Notification<?>>, Observable<?>> createRetryDematerializer
(Func1<? super Observable<? extends Throwable>, ? extends Observable<?>> notificationHandler) Returns a function that dematerializes the notification signal from an Observable and calls a notification handler with the Throwable.equalsWith
(Object other) Returns a Func1 that checks if its argument is null-safe equals with the given constant reference.isInstanceOf
(Class<?> clazz) Returns a Func1 that checks if its argument is an instance of the supplied class.static InternalObservableUtils
Returns the enum constant of this class with the specified name.static InternalObservableUtils[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Field Details
-
LONG_COUNTER
A BiFunction that expects a long as its first parameter and returns +1. -
OBJECT_EQUALS
A bifunction comparing two objects via null-safe equals. -
TO_ARRAY
A function that converts a List of Observables into an array of Observables. -
RETURNS_VOID
-
COUNTER
A BiFunction that expects an integer as its first parameter and returns +1. -
ERROR_EXTRACTOR
-
ERROR_NOT_IMPLEMENTED
Throws an OnErrorNotImplementedException when called. -
IS_EMPTY
-
-
Constructor Details
-
InternalObservableUtils
private InternalObservableUtils()
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
equalsWith
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
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 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 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
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, 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, 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
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
-