Skip to content

Commit

Permalink
Update wording to use Introspection
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacSweers committed Sep 10, 2017
1 parent e2d06c0 commit bae194c
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import io.reactivex.exceptions.*;
import io.reactivex.functions.*;
import io.reactivex.internal.disposables.DisposableHelper;
import io.reactivex.observers.CompositeObserver;
import io.reactivex.observers.LambdaConsumerIntrospection;
import io.reactivex.plugins.RxJavaPlugins;

public final class CallbackCompletableObserver
extends AtomicReference<Disposable>
implements CompletableObserver, Disposable, Consumer<Throwable>, CompositeObserver {
implements CompletableObserver, Disposable, Consumer<Throwable>, LambdaConsumerIntrospection {


private static final long serialVersionUID = -4361286194466301354L;
Expand Down Expand Up @@ -86,7 +86,7 @@ public boolean isDisposed() {
}

@Override
public boolean onErrorImplemented() {
public boolean hasCustomOnError() {
return onError == this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
import io.reactivex.functions.Consumer;
import io.reactivex.internal.disposables.*;
import io.reactivex.internal.functions.Functions;
import io.reactivex.observers.CompositeObserver;
import io.reactivex.observers.LambdaConsumerIntrospection;
import io.reactivex.plugins.RxJavaPlugins;

public final class ConsumerSingleObserver<T>
extends AtomicReference<Disposable>
implements SingleObserver<T>, Disposable, CompositeObserver {
implements SingleObserver<T>, Disposable, LambdaConsumerIntrospection {


private static final long serialVersionUID = -7012088219455310787L;
Expand Down Expand Up @@ -78,7 +78,7 @@ public boolean isDisposed() {
}

@Override
public boolean onErrorImplemented() {
public boolean hasCustomOnError() {
return onError == Functions.ON_ERROR_MISSING;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
import io.reactivex.disposables.Disposable;
import io.reactivex.exceptions.OnErrorNotImplementedException;
import io.reactivex.internal.disposables.DisposableHelper;
import io.reactivex.observers.CompositeObserver;
import io.reactivex.observers.LambdaConsumerIntrospection;
import io.reactivex.plugins.RxJavaPlugins;

public final class EmptyCompletableObserver
extends AtomicReference<Disposable>
implements CompletableObserver, Disposable, CompositeObserver {
implements CompletableObserver, Disposable, LambdaConsumerIntrospection {


private static final long serialVersionUID = -7545121636549663526L;
Expand Down Expand Up @@ -57,7 +57,7 @@ public void onSubscribe(Disposable d) {
}

@Override
public boolean onErrorImplemented() {
public boolean hasCustomOnError() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
import io.reactivex.functions.*;
import io.reactivex.internal.disposables.DisposableHelper;
import io.reactivex.internal.functions.Functions;
import io.reactivex.observers.CompositeObserver;
import io.reactivex.observers.LambdaConsumerIntrospection;
import io.reactivex.plugins.RxJavaPlugins;

public final class LambdaObserver<T> extends AtomicReference<Disposable>
implements Observer<T>, Disposable, CompositeObserver {
implements Observer<T>, Disposable, LambdaConsumerIntrospection {

private static final long serialVersionUID = -7251123623727029452L;
final Consumer<? super T> onNext;
Expand Down Expand Up @@ -106,7 +106,7 @@ public boolean isDisposed() {
}

@Override
public boolean onErrorImplemented() {
public boolean hasCustomOnError() {
return onError == Functions.ON_ERROR_MISSING;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import io.reactivex.functions.*;
import io.reactivex.internal.disposables.DisposableHelper;
import io.reactivex.internal.functions.Functions;
import io.reactivex.observers.CompositeObserver;
import io.reactivex.observers.LambdaConsumerIntrospection;
import io.reactivex.plugins.RxJavaPlugins;

/**
Expand All @@ -31,7 +31,7 @@
*/
public final class MaybeCallbackObserver<T>
extends AtomicReference<Disposable>
implements MaybeObserver<T>, Disposable, CompositeObserver {
implements MaybeObserver<T>, Disposable, LambdaConsumerIntrospection {


private static final long serialVersionUID = -6076952298809384986L;
Expand Down Expand Up @@ -99,7 +99,7 @@ public void onComplete() {
}

@Override
public boolean onErrorImplemented() {
public boolean hasCustomOnError() {
return onError == Functions.ON_ERROR_MISSING;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.concurrent.atomic.AtomicReference;

import io.reactivex.internal.functions.Functions;
import io.reactivex.observers.CompositeObserver;
import io.reactivex.observers.LambdaConsumerIntrospection;
import org.reactivestreams.Subscription;

import io.reactivex.FlowableSubscriber;
Expand All @@ -27,7 +27,7 @@
import io.reactivex.plugins.RxJavaPlugins;

public final class LambdaSubscriber<T> extends AtomicReference<Subscription>
implements FlowableSubscriber<T>, Subscription, Disposable, CompositeObserver {
implements FlowableSubscriber<T>, Subscription, Disposable, LambdaConsumerIntrospection {

private static final long serialVersionUID = -7251123623727029452L;
final Consumer<? super T> onNext;
Expand Down Expand Up @@ -120,7 +120,7 @@ public void cancel() {
}

@Override
public boolean onErrorImplemented() {
public boolean hasCustomOnError() {
return onError == Functions.ON_ERROR_MISSING;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
* An interface that indicates that the implementing type is composed of individual components and exposes information
* about their behavior.
*
* <p><em>NOTE:</em> This is considered a read-only public API and is not intended to be implemented by consumers.
* <p><em>NOTE:</em> This is considered a read-only public API and is not intended to be implemented externally.
*
* @since 2.1.4 - experimental
*/
@Experimental
public interface CompositeObserver {
public interface LambdaConsumerIntrospection {

/**
* @return {@code true} if a concrete error consumer implementation was supplied. Returns {@code false} if the
* @return {@code true} if a custom onError consumer implementation was supplied. Returns {@code false} if the
* implementation is missing an error consumer and thus using a throwing default implementation.
*/
@Experimental
boolean onErrorImplemented();
boolean hasCustomOnError();

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ public final class CallbackCompletableObserverTest {
public void hasMissingErrorConsumer() {
CallbackCompletableObserver o = new CallbackCompletableObserver(Functions.EMPTY_ACTION);

assertTrue(o.onErrorImplemented());
assertTrue(o.hasCustomOnError());
}

@Test
public void isNotMissingErrorConsumer() {
CallbackCompletableObserver o = new CallbackCompletableObserver(Functions.<Throwable>emptyConsumer(),
Functions.EMPTY_ACTION);

assertFalse(o.onErrorImplemented());
assertFalse(o.hasCustomOnError());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ public void hasMissingErrorConsumer() {
ConsumerSingleObserver<Integer> o = new ConsumerSingleObserver<Integer>(Functions.<Integer>emptyConsumer(),
Functions.ON_ERROR_MISSING);

assertTrue(o.onErrorImplemented());
assertTrue(o.hasCustomOnError());
}

@Test
public void isNotMissingErrorConsumer() {
ConsumerSingleObserver<Integer> o = new ConsumerSingleObserver<Integer>(Functions.<Integer>emptyConsumer(),
Functions.<Throwable>emptyConsumer());

assertFalse(o.onErrorImplemented());
assertFalse(o.hasCustomOnError());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ public final class EmptyCompletableObserverTest {
public void hasMissingErrorConsumer() {
EmptyCompletableObserver o = new EmptyCompletableObserver();

assertTrue(o.onErrorImplemented());
assertTrue(o.hasCustomOnError());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ public void hasMissingErrorConsumer() {
Functions.EMPTY_ACTION,
Functions.<Disposable>emptyConsumer());

assertTrue(o.onErrorImplemented());
assertTrue(o.hasCustomOnError());
}

@Test
Expand All @@ -361,6 +361,6 @@ public void isNotMissingErrorConsumer() {
Functions.EMPTY_ACTION,
Functions.<Disposable>emptyConsumer());

assertFalse(o.onErrorImplemented());
assertFalse(o.hasCustomOnError());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void hasMissingErrorConsumer() {
Functions.ON_ERROR_MISSING,
Functions.EMPTY_ACTION);

assertTrue(o.onErrorImplemented());
assertTrue(o.hasCustomOnError());
}

@Test
Expand All @@ -136,6 +136,6 @@ public void isNotMissingErrorConsumer() {
Functions.<Throwable>emptyConsumer(),
Functions.EMPTY_ACTION);

assertFalse(o.onErrorImplemented());
assertFalse(o.hasCustomOnError());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ public void hasMissingErrorConsumer() {
Functions.EMPTY_ACTION,
FlowableInternalHelper.RequestMax.INSTANCE);

assertTrue(o.onErrorImplemented());
assertTrue(o.hasCustomOnError());
}

@Test
Expand All @@ -366,6 +366,6 @@ public void isNotMissingErrorConsumer() {
Functions.EMPTY_ACTION,
FlowableInternalHelper.RequestMax.INSTANCE);

assertFalse(o.onErrorImplemented());
assertFalse(o.hasCustomOnError());
}
}

0 comments on commit bae194c

Please sign in to comment.