Skip to content

Commit db3ff46

Browse files
JakeWhartonakarnokd
authored andcommitted
Remove 'Completable' prefix from nested interfaces, move its subscription to top-level. (#4425)
1 parent c258048 commit db3ff46

22 files changed

+393
-233
lines changed

src/main/java/rx/Completable.java

Lines changed: 204 additions & 80 deletions
Large diffs are not rendered by default.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright 2016 Netflix, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package rx;
17+
18+
import rx.annotations.Experimental;
19+
20+
/**
21+
* Represents the subscription API callbacks when subscribing to a Completable instance.
22+
*/
23+
@Experimental
24+
public interface CompletableSubscriber {
25+
/**
26+
* Called once the deferred computation completes normally.
27+
*/
28+
void onCompleted();
29+
30+
/**
31+
* Called once if the deferred computation 'throws' an exception.
32+
* @param e the exception, not null.
33+
*/
34+
void onError(Throwable e);
35+
36+
/**
37+
* Called once by the Completable to set a Subscription on this instance which
38+
* then can be used to cancel the subscription at any time.
39+
* @param d the Subscription instance to call dispose on for cancellation, not null
40+
*/
41+
void onSubscribe(Subscription d);
42+
}

src/main/java/rx/Single.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2021,7 +2021,7 @@ public void onCompleted() {
20212021
}
20222022
};
20232023

2024-
final Completable.CompletableSubscriber so = new Completable.CompletableSubscriber() {
2024+
final CompletableSubscriber so = new CompletableSubscriber() {
20252025
@Override
20262026
public void onCompleted() {
20272027
onError(new CancellationException("Stream was canceled before emitting a terminal event."));

src/main/java/rx/internal/operators/CompletableFlatMapSingleToCompletable.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
package rx.internal.operators;
1818

1919
import rx.Completable;
20-
import rx.Completable.CompletableOnSubscribe;
21-
import rx.Completable.CompletableSubscriber;
20+
import rx.Completable.OnSubscribe;
21+
import rx.CompletableSubscriber;
2222
import rx.Single;
2323
import rx.SingleSubscriber;
2424
import rx.Subscription;
2525
import rx.exceptions.Exceptions;
2626
import rx.functions.Func1;
2727

28-
public final class CompletableFlatMapSingleToCompletable<T> implements CompletableOnSubscribe {
28+
public final class CompletableFlatMapSingleToCompletable<T> implements OnSubscribe {
2929

3030
final Single<T> source;
3131

src/main/java/rx/internal/operators/CompletableOnSubscribeConcat.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
import java.util.concurrent.atomic.*;
2020

2121
import rx.*;
22-
import rx.Completable.*;
22+
import rx.Completable.OnSubscribe;
2323
import rx.exceptions.MissingBackpressureException;
2424
import rx.internal.util.unsafe.SpscArrayQueue;
2525
import rx.plugins.RxJavaHooks;
2626
import rx.subscriptions.SerialSubscription;
2727

28-
public final class CompletableOnSubscribeConcat implements CompletableOnSubscribe {
28+
public final class CompletableOnSubscribeConcat implements OnSubscribe {
2929
final Observable<Completable> sources;
3030
final int prefetch;
3131

src/main/java/rx/internal/operators/CompletableOnSubscribeConcatArray.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
import java.util.concurrent.atomic.AtomicInteger;
2020

2121
import rx.*;
22-
import rx.Completable.*;
22+
import rx.Completable.OnSubscribe;
2323
import rx.subscriptions.SerialSubscription;
2424

25-
public final class CompletableOnSubscribeConcatArray implements CompletableOnSubscribe {
25+
public final class CompletableOnSubscribeConcatArray implements OnSubscribe {
2626
final Completable[] sources;
2727

2828
public CompletableOnSubscribeConcatArray(Completable[] sources) {

src/main/java/rx/internal/operators/CompletableOnSubscribeConcatIterable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
import java.util.concurrent.atomic.AtomicInteger;
2121

2222
import rx.*;
23-
import rx.Completable.*;
23+
import rx.Completable.OnSubscribe;
2424
import rx.subscriptions.*;
2525

26-
public final class CompletableOnSubscribeConcatIterable implements CompletableOnSubscribe {
26+
public final class CompletableOnSubscribeConcatIterable implements OnSubscribe {
2727
final Iterable<? extends Completable> sources;
2828

2929
public CompletableOnSubscribeConcatIterable(Iterable<? extends Completable> sources) {

src/main/java/rx/internal/operators/CompletableOnSubscribeMerge.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
import java.util.concurrent.atomic.*;
2222

2323
import rx.*;
24-
import rx.Completable.*;
24+
import rx.Completable.OnSubscribe;
2525
import rx.Observable;
2626
import rx.exceptions.CompositeException;
2727
import rx.plugins.RxJavaHooks;
2828
import rx.subscriptions.CompositeSubscription;
2929

30-
public final class CompletableOnSubscribeMerge implements CompletableOnSubscribe {
30+
public final class CompletableOnSubscribeMerge implements OnSubscribe {
3131
final Observable<Completable> source;
3232
final int maxConcurrency;
3333
final boolean delayErrors;

src/main/java/rx/internal/operators/CompletableOnSubscribeMergeArray.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
import java.util.concurrent.atomic.*;
2020

2121
import rx.*;
22-
import rx.Completable.*;
22+
import rx.Completable.OnSubscribe;
2323
import rx.plugins.RxJavaHooks;
2424
import rx.subscriptions.CompositeSubscription;
2525

26-
public final class CompletableOnSubscribeMergeArray implements CompletableOnSubscribe {
26+
public final class CompletableOnSubscribeMergeArray implements OnSubscribe {
2727
final Completable[] sources;
2828

2929
public CompletableOnSubscribeMergeArray(Completable[] sources) {

src/main/java/rx/internal/operators/CompletableOnSubscribeMergeDelayErrorArray.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
import java.util.concurrent.atomic.AtomicInteger;
2222

2323
import rx.*;
24-
import rx.Completable.*;
24+
import rx.Completable.OnSubscribe;
2525
import rx.subscriptions.CompositeSubscription;
2626

27-
public final class CompletableOnSubscribeMergeDelayErrorArray implements CompletableOnSubscribe {
27+
public final class CompletableOnSubscribeMergeDelayErrorArray implements OnSubscribe {
2828
final Completable[] sources;
2929

3030
public CompletableOnSubscribeMergeDelayErrorArray(Completable[] sources) {

src/main/java/rx/internal/operators/CompletableOnSubscribeMergeDelayErrorIterable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
import java.util.concurrent.atomic.AtomicInteger;
2121

2222
import rx.*;
23-
import rx.Completable.*;
23+
import rx.Completable.OnSubscribe;
2424
import rx.internal.util.unsafe.MpscLinkedQueue;
2525
import rx.subscriptions.CompositeSubscription;
2626

27-
public final class CompletableOnSubscribeMergeDelayErrorIterable implements CompletableOnSubscribe {
27+
public final class CompletableOnSubscribeMergeDelayErrorIterable implements OnSubscribe {
2828
final Iterable<? extends Completable> sources;
2929

3030
public CompletableOnSubscribeMergeDelayErrorIterable(Iterable<? extends Completable> sources) {

src/main/java/rx/internal/operators/CompletableOnSubscribeMergeIterable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
import java.util.concurrent.atomic.*;
2121

2222
import rx.*;
23-
import rx.Completable.*;
23+
import rx.Completable.OnSubscribe;
2424
import rx.plugins.RxJavaHooks;
2525
import rx.subscriptions.CompositeSubscription;
2626

27-
public final class CompletableOnSubscribeMergeIterable implements CompletableOnSubscribe {
27+
public final class CompletableOnSubscribeMergeIterable implements OnSubscribe {
2828
final Iterable<? extends Completable> sources;
2929

3030
public CompletableOnSubscribeMergeIterable(Iterable<? extends Completable> sources) {

src/main/java/rx/internal/operators/CompletableOnSubscribeTimeout.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
import java.util.concurrent.atomic.AtomicBoolean;
2121

2222
import rx.*;
23-
import rx.Completable.*;
23+
import rx.Completable.OnSubscribe;
2424
import rx.functions.Action0;
2525
import rx.plugins.RxJavaHooks;
2626
import rx.subscriptions.CompositeSubscription;
2727

28-
public final class CompletableOnSubscribeTimeout implements CompletableOnSubscribe {
28+
public final class CompletableOnSubscribeTimeout implements OnSubscribe {
2929

3030
final Completable source;
3131
final long timeout;

src/main/java/rx/internal/operators/OnSubscribeOnAssemblyCompletable.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package rx.internal.operators;
1717

1818
import rx.*;
19-
import rx.Completable.CompletableSubscriber;
19+
import rx.CompletableSubscriber;
2020
import rx.exceptions.AssemblyStackTraceException;
2121

2222
/**
@@ -26,9 +26,9 @@
2626
*
2727
* @param <T> the value type
2828
*/
29-
public final class OnSubscribeOnAssemblyCompletable<T> implements Completable.CompletableOnSubscribe {
29+
public final class OnSubscribeOnAssemblyCompletable<T> implements Completable.OnSubscribe {
3030

31-
final Completable.CompletableOnSubscribe source;
31+
final Completable.OnSubscribe source;
3232

3333
final String stacktrace;
3434

@@ -38,13 +38,13 @@ public final class OnSubscribeOnAssemblyCompletable<T> implements Completable.Co
3838
*/
3939
public static volatile boolean fullStackTrace;
4040

41-
public OnSubscribeOnAssemblyCompletable(Completable.CompletableOnSubscribe source) {
41+
public OnSubscribeOnAssemblyCompletable(Completable.OnSubscribe source) {
4242
this.source = source;
4343
this.stacktrace = OnSubscribeOnAssembly.createStacktrace();
4444
}
4545

4646
@Override
47-
public void call(Completable.CompletableSubscriber t) {
47+
public void call(CompletableSubscriber t) {
4848
source.call(new OnAssemblyCompletableSubscriber(t, stacktrace));
4949
}
5050

src/main/java/rx/internal/schedulers/SchedulerWhen.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
import java.util.concurrent.atomic.AtomicReference;
2121

2222
import rx.Completable;
23-
import rx.Completable.CompletableOnSubscribe;
24-
import rx.Completable.CompletableSubscriber;
25-
import rx.Scheduler.Worker;
23+
import rx.Completable.OnSubscribe;
24+
import rx.CompletableSubscriber;
2625
import rx.Observable;
2726
import rx.Observer;
2827
import rx.Scheduler;
@@ -143,7 +142,7 @@ public Worker createWorker() {
143142
Observable<Completable> actions = actionSubject.map(new Func1<ScheduledAction, Completable>() {
144143
@Override
145144
public Completable call(final ScheduledAction action) {
146-
return Completable.create(new CompletableOnSubscribe() {
145+
return Completable.create(new OnSubscribe() {
147146
@Override
148147
public void call(CompletableSubscriber actionCompletable) {
149148
actionCompletable.onSubscribe(action);

src/main/java/rx/observers/AsyncCompletableSubscriber.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import java.util.concurrent.atomic.AtomicReference;
1919

20-
import rx.Completable.CompletableSubscriber;
20+
import rx.CompletableSubscriber;
2121
import rx.Subscription;
2222
import rx.annotations.Experimental;
2323
import rx.plugins.RxJavaHooks;

src/main/java/rx/observers/SafeCompletableSubscriber.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
package rx.observers;
1717

18-
import rx.Completable.CompletableSubscriber;
18+
import rx.CompletableSubscriber;
1919
import rx.Subscription;
2020
import rx.annotations.Experimental;
2121
import rx.exceptions.*;

src/main/java/rx/plugins/RxJavaCompletableExecutionHook.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@
4040
@Experimental
4141
public abstract class RxJavaCompletableExecutionHook { // NOPMD
4242
/**
43-
* Invoked during the construction by {@link Completable#create(Completable.CompletableOnSubscribe)}
43+
* Invoked during the construction by {@link Completable#create(Completable.OnSubscribe)}
4444
* <p>
4545
* This can be used to decorate or replace the <code>onSubscribe</code> function or just perform extra
4646
* logging, metrics and other such things and pass through the function.
4747
*
4848
* @param f
49-
* original {@link rx.Completable.CompletableOnSubscribe}<{@code T}> to be executed
50-
* @return {@link rx.Completable.CompletableOnSubscribe} function that can be modified, decorated, replaced or just
49+
* original {@link Completable.OnSubscribe}<{@code T}> to be executed
50+
* @return {@link Completable.OnSubscribe} function that can be modified, decorated, replaced or just
5151
* returned as a pass through
5252
*/
5353
@Deprecated
54-
public Completable.CompletableOnSubscribe onCreate(Completable.CompletableOnSubscribe f) {
54+
public Completable.OnSubscribe onCreate(Completable.OnSubscribe f) {
5555
return f;
5656
}
5757

@@ -63,12 +63,12 @@ public Completable.CompletableOnSubscribe onCreate(Completable.CompletableOnSubs
6363
*
6464
* @param completableInstance the target completable instance
6565
* @param onSubscribe
66-
* original {@link rx.Completable.CompletableOnSubscribe}<{@code T}> to be executed
67-
* @return {@link rx.Completable.CompletableOnSubscribe}<{@code T}> function that can be modified, decorated, replaced or just
66+
* original {@link Completable.OnSubscribe}<{@code T}> to be executed
67+
* @return {@link Completable.OnSubscribe}<{@code T}> function that can be modified, decorated, replaced or just
6868
* returned as a pass through
6969
*/
7070
@Deprecated
71-
public Completable.CompletableOnSubscribe onSubscribeStart(Completable completableInstance, final Completable.CompletableOnSubscribe onSubscribe) {
71+
public Completable.OnSubscribe onSubscribeStart(Completable completableInstance, final Completable.OnSubscribe onSubscribe) {
7272
// pass through by default
7373
return onSubscribe;
7474
}
@@ -93,16 +93,16 @@ public Throwable onSubscribeError(Throwable e) {
9393
* Invoked just as the operator functions is called to bind two operations together into a new
9494
* {@link Completable} and the return value is used as the lifted function
9595
* <p>
96-
* This can be used to decorate or replace the {@link rx.Completable.CompletableOperator} instance or just perform extra
96+
* This can be used to decorate or replace the {@link Completable.Operator} instance or just perform extra
9797
* logging, metrics and other such things and pass through the onSubscribe.
9898
*
9999
* @param lift
100-
* original {@link rx.Completable.CompletableOperator}{@code <R, T>}
101-
* @return {@link rx.Completable.CompletableOperator}{@code <R, T>} function that can be modified, decorated, replaced or just
100+
* original {@link Completable.Operator}{@code <R, T>}
101+
* @return {@link Completable.Operator}{@code <R, T>} function that can be modified, decorated, replaced or just
102102
* returned as a pass through
103103
*/
104104
@Deprecated
105-
public Completable.CompletableOperator onLift(final Completable.CompletableOperator lift) {
105+
public Completable.Operator onLift(final Completable.Operator lift) {
106106
return lift;
107107
}
108108
}

0 commit comments

Comments
 (0)