Skip to content

Commit

Permalink
Updated generic parameters of Transformer<T, T> to support Kotlin typ…
Browse files Browse the repository at this point in the history
…e inference
  • Loading branch information
Anton Danshin committed Sep 29, 2015
1 parent de83489 commit 43f052a
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public interface ActivityLifecycleProvider {
* @param event the {@link ActivityEvent} that triggers unsubscription
* @return a reusable {@link rx.Observable.Transformer} which unsubscribes when the event triggers.
*/
<T> Observable.Transformer<T, T> bindUntilEvent(ActivityEvent event);
<T> Observable.Transformer<? super T, ? extends T> bindUntilEvent(ActivityEvent event);

/**
* Binds a source until the next reasonable {@link ActivityEvent} occurs.
Expand All @@ -33,6 +33,6 @@ public interface ActivityLifecycleProvider {
*
* @return a reusable {@link rx.Observable.Transformer} which unsubscribes at the correct time.
*/
<T> Observable.Transformer<T, T> bindToLifecycle();
<T> Observable.Transformer<? super T, ? extends T> bindToLifecycle();

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public interface FragmentLifecycleProvider {
* @param event the {@link FragmentEvent} that triggers unsubscription
* @return a reusable {@link rx.Observable.Transformer} which unsubscribes when the event triggers.
*/
<T> Observable.Transformer<T, T> bindUntilEvent(FragmentEvent event);
<T> Observable.Transformer<? super T, ? extends T> bindUntilEvent(FragmentEvent event);

/**
* Binds a source until the next reasonable {@link FragmentEvent} occurs.
Expand All @@ -33,6 +33,6 @@ public interface FragmentLifecycleProvider {
*
* @return a reusable {@link rx.Observable.Transformer} which unsubscribes at the correct time.
*/
<T> Observable.Transformer<T, T> bindToLifecycle();
<T> Observable.Transformer<? super T, ? extends T> bindToLifecycle();

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ public final Observable<ActivityEvent> lifecycle() {
}

@Override
public final <T> Observable.Transformer<T, T> bindUntilEvent(ActivityEvent event) {
public final <T> Observable.Transformer<? super T, ? extends T> bindUntilEvent(ActivityEvent event) {
return RxLifecycle.bindUntilActivityEvent(lifecycleSubject, event);
}

@Override
public final <T> Observable.Transformer<T, T> bindToLifecycle() {
public final <T> Observable.Transformer<? super T, ? extends T> bindToLifecycle() {
return RxLifecycle.bindActivity(lifecycleSubject);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public final Observable<FragmentEvent> lifecycle() {
}

@Override
public final <T> Observable.Transformer<T, T> bindUntilEvent(FragmentEvent event) {
public final <T> Observable.Transformer<? super T, ? extends T> bindUntilEvent(FragmentEvent event) {
return RxLifecycle.bindUntilFragmentEvent(lifecycleSubject, event);
}

@Override
public final <T> Observable.Transformer<T, T> bindToLifecycle() {
public final <T> Observable.Transformer<? super T, ? extends T> bindToLifecycle() {
return RxLifecycle.bindFragment(lifecycleSubject);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public final Observable<FragmentEvent> lifecycle() {
}

@Override
public final <T> Observable.Transformer<T, T> bindUntilEvent(FragmentEvent event) {
public final <T> Observable.Transformer<? super T, ? extends T> bindUntilEvent(FragmentEvent event) {
return RxLifecycle.bindUntilFragmentEvent(lifecycleSubject, event);
}

@Override
public final <T> Observable.Transformer<T, T> bindToLifecycle() {
public final <T> Observable.Transformer<? super T, ? extends T> bindToLifecycle() {
return RxLifecycle.bindFragment(lifecycleSubject);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public final Observable<ActivityEvent> lifecycle() {
}

@Override
public final <T> Observable.Transformer<T, T> bindUntilEvent(ActivityEvent event) {
public final <T> Observable.Transformer<? super T, ? extends T> bindUntilEvent(ActivityEvent event) {
return RxLifecycle.bindUntilActivityEvent(lifecycleSubject, event);
}

@Override
public final <T> Observable.Transformer<T, T> bindToLifecycle() {
public final <T> Observable.Transformer<? super T, ? extends T> bindToLifecycle() {
return RxLifecycle.bindActivity(lifecycleSubject);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ public final Observable<FragmentEvent> lifecycle() {
}

@Override
public final <T> Observable.Transformer<T, T> bindUntilEvent(FragmentEvent event) {
public final <T> Observable.Transformer<? super T, ? extends T> bindUntilEvent(FragmentEvent event) {
return RxLifecycle.bindUntilFragmentEvent(lifecycleSubject, event);
}

@Override
public final <T> Observable.Transformer<T, T> bindToLifecycle() {
public final <T> Observable.Transformer<? super T, ? extends T> bindToLifecycle() {
return RxLifecycle.bindFragment(lifecycleSubject);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ public final Observable<FragmentEvent> lifecycle() {
}

@Override
public final <T> Observable.Transformer<T, T> bindUntilEvent(FragmentEvent event) {
public final <T> Observable.Transformer<? super T, ? extends T> bindUntilEvent(FragmentEvent event) {
return RxLifecycle.bindUntilFragmentEvent(lifecycleSubject, event);
}

@Override
public final <T> Observable.Transformer<T, T> bindToLifecycle() {
public final <T> Observable.Transformer<? super T, ? extends T> bindToLifecycle() {
return RxLifecycle.bindFragment(lifecycleSubject);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public final Observable<ActivityEvent> lifecycle() {
}

@Override
public final <T> Observable.Transformer<T, T> bindUntilEvent(ActivityEvent event) {
public final <T> Observable.Transformer<? super T, ? extends T> bindUntilEvent(ActivityEvent event) {
return RxLifecycle.bindUntilActivityEvent(lifecycleSubject, event);
}

@Override
public final <T> Observable.Transformer<T, T> bindToLifecycle() {
public final <T> Observable.Transformer<? super T, ? extends T> bindToLifecycle() {
return RxLifecycle.bindActivity(lifecycleSubject);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private RxLifecycle() {
* @param event the event which should conclude notifications from the source
* @return a reusable {@link Observable.Transformer} that unsubscribes the source at the specified event
*/
public static <T> Observable.Transformer<T, T> bindUntilFragmentEvent(
public static <T> Observable.Transformer<? super T, ? extends T> bindUntilFragmentEvent(
final Observable<FragmentEvent> lifecycle, final FragmentEvent event) {
return bindUntilEvent(lifecycle, event);
}
Expand All @@ -57,12 +57,12 @@ public static <T> Observable.Transformer<T, T> bindUntilFragmentEvent(
* @param event the event which should conclude notifications from the source
* @return a reusable {@link Observable.Transformer} that unsubscribes the source at the specified event
*/
public static <T> Observable.Transformer<T, T> bindUntilActivityEvent(
public static <T> Observable.Transformer<? super T, ? extends T> bindUntilActivityEvent(
final Observable<ActivityEvent> lifecycle, final ActivityEvent event) {
return bindUntilEvent(lifecycle, event);
}

private static <T, R> Observable.Transformer<T, T> bindUntilEvent(final Observable<R> lifecycle,
private static <T, R> Observable.Transformer<? super T, ? extends T> bindUntilEvent(final Observable<R> lifecycle,
final R event) {
if (lifecycle == null) {
throw new IllegalArgumentException("Lifecycle must be given");
Expand Down Expand Up @@ -104,7 +104,7 @@ public Boolean call(R lifecycleEvent) {
* @param lifecycle the lifecycle sequence of an Activity
* * @return a reusable {@link Observable.Transformer} that unsubscribes the source during the Activity lifecycle
*/
public static <T> Observable.Transformer<T, T> bindActivity(Observable<ActivityEvent> lifecycle) {
public static <T> Observable.Transformer<? super T, ? extends T> bindActivity(Observable<ActivityEvent> lifecycle) {
return bind(lifecycle, ACTIVITY_LIFECYCLE);
}

Expand All @@ -126,7 +126,7 @@ public static <T> Observable.Transformer<T, T> bindActivity(Observable<ActivityE
* @param lifecycle the lifecycle sequence of a Fragment
* @return a reusable {@link Observable.Transformer} that unsubscribes the source during the Fragment lifecycle
*/
public static <T> Observable.Transformer<T, T> bindFragment(Observable<FragmentEvent> lifecycle) {
public static <T> Observable.Transformer<? super T, ? extends T> bindFragment(Observable<FragmentEvent> lifecycle) {
return bind(lifecycle, FRAGMENT_LIFECYCLE);
}

Expand All @@ -146,7 +146,7 @@ public static <T> Observable.Transformer<T, T> bindFragment(Observable<FragmentE
* @param view the view to bind the source sequence to
* @return a reusable {@link Observable.Transformer} that unsubscribes the source during the View lifecycle
*/
public static <T> Observable.Transformer<T, T> bindView(final View view) {
public static <T> Observable.Transformer<? super T, ? extends T> bindView(final View view) {
if (view == null) {
throw new IllegalArgumentException("View must be given");
}
Expand All @@ -168,7 +168,7 @@ public static <T> Observable.Transformer<T, T> bindView(final View view) {
* @param lifecycle the lifecycle sequence of a View
* @return a reusable {@link Observable.Transformer} that unsubscribes the source during the View lifecycle
*/
public static <T, E> Observable.Transformer<T, T> bindView(final Observable<? extends E> lifecycle) {
public static <T, E> Observable.Transformer<? super T, ? extends T> bindView(final Observable<? extends E> lifecycle) {
if (lifecycle == null) {
throw new IllegalArgumentException("Lifecycle must be given");
}
Expand All @@ -181,7 +181,7 @@ public Observable<T> call(Observable<T> source) {
};
}

private static <T, R> Observable.Transformer<T, T> bind(Observable<R> lifecycle,
private static <T, R> Observable.Transformer<? super T, ? extends T> bind(Observable<R> lifecycle,
final Func1<R, R> correspondingEvents) {
if (lifecycle == null) {
throw new IllegalArgumentException("Lifecycle must be given");
Expand Down

0 comments on commit 43f052a

Please sign in to comment.