Skip to content

Commit 5796e71

Browse files
update package objects
1 parent d80dfae commit 5796e71

File tree

5 files changed

+8
-211
lines changed

5 files changed

+8
-211
lines changed

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/package.scala

Lines changed: 0 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ package rx.lang
1818
import java.util.concurrent.TimeUnit
1919
import java.util.Date
2020

21-
/*
22-
* Note that:
23-
* - Scala users cannot use Java's types with variance without always using writing
24-
* e.g. rx.Notification[_ <: T], so we create aliases fixing the variance
25-
* - For consistency, we create aliases for all types which Scala users need
26-
*/
27-
2821
/**
2922
* This package contains all classes that RxScala users need.
3023
*
@@ -33,95 +26,6 @@ import java.util.Date
3326
*/
3427
package object scala {
3528

36-
/*
37-
* Here we're imitating C's preprocessor using Search & Replace.
38-
*
39-
* To activate the code needed to get nice Scaladoc, do the following replacements:
40-
* /*//#ifdef SCALADOC --> //#ifdef SCALADOC
41-
* *///#else --> /*//#else
42-
* //#endif --> *///#endif
43-
*
44-
* To get back to the actual code, undo the above replacements.
45-
*
46-
*/
47-
48-
/*//#ifdef SCALADOC
49-
50-
/**
51-
* Provides a mechanism for receiving push-based notifications.
52-
*
53-
* After an Observer calls an [[Observable]]'s `subscribe` method, the Observable
54-
* calls the Observer's `onNext` method to provide notifications. A well-behaved Observable will
55-
* call an Observer's `onCompleted` method exactly once or the Observer's `onError` method exactly once.
56-
*/
57-
trait Observer[-T] {
58-
59-
/**
60-
* Notifies the Observer that the [[Observable]] has finished sending push-based notifications.
61-
*
62-
* The [[Observable]] will not call this method if it calls `onError`.
63-
*/
64-
def onCompleted(): Unit
65-
66-
/**
67-
* Notifies the Observer that the [[Observable]] has experienced an error condition.
68-
*
69-
* If the [[Observable]] calls this method, it will not thereafter call `onNext` or `onCompleted`.
70-
*/
71-
def onError(e: Throwable): Unit
72-
73-
/**
74-
* Provides the Observer with new data.
75-
*
76-
* The [[Observable]] calls this closure 0 or more times.
77-
*
78-
* The [[Observable]] will not call this method again after it calls either `onCompleted` or `onError`.
79-
*/
80-
def onNext(arg: T): Unit
81-
}
82-
83-
/**
84-
* Subscriptions are returned from all `Observable.subscribe` methods to allow unsubscribing.
85-
*
86-
* This interface is the equivalent of `IDisposable` in the .NET Rx implementation.
87-
*/
88-
trait Subscription {
89-
/**
90-
* Call this method to stop receiving notifications on the Observer that was registered when
91-
* this Subscription was received.
92-
*/
93-
def unsubscribe(): Unit
94-
}
95-
96-
import language.implicitConversions
97-
98-
private[scala] implicit def fakeSubscription2RxSubscription(s: Subscription): rx.Subscription =
99-
new rx.Subscription {
100-
def unsubscribe() = s.unsubscribe()
101-
}
102-
private[scala] implicit def rxSubscription2FakeSubscription(s: rx.Subscription): Subscription =
103-
new Subscription {
104-
def unsubscribe() = s.unsubscribe()
105-
}
106-
107-
private[scala] implicit def schedulerActionToFunc2[T](action: (Scheduler, T) => Subscription) =
108-
new rx.util.functions.Func2[rx.Scheduler, T, rx.Subscription] {
109-
def call(s: rx.Scheduler, t: T): rx.Subscription = {
110-
action(ImplicitFunctionConversions.javaSchedulerToScalaScheduler(s), t)
111-
}
112-
}
113-
114-
private[scala] implicit def fakeObserver2RxObserver[T](o: Observer[T]): rx.Observer[_ >: T] = ???
115-
private[scala] implicit def rxObserver2fakeObserver[T](o: rx.Observer[_ >: T]): Observer[T] = ???
116-
117-
*///#else
118-
119-
type Observer[-T] = rx.Observer[_ >: T]
120-
121-
type Subscription = rx.Subscription
122-
123-
//#endif
124-
12529
/**
12630
* Allows to construct observables in a similar way as futures.
12731
*
@@ -142,17 +46,3 @@ package object scala {
14246
Observable(1).observeOn(scheduler).map(_ => body)
14347
}
14448
}
145-
146-
/*
147-
148-
These classes are considered unnecessary for Scala users, so we don't create aliases for them:
149-
150-
rx.plugins.RxJavaErrorHandler
151-
rx.plugins.RxJavaObservableExecutionHook
152-
rx.plugins.RxJavaPlugins
153-
154-
rx.subscriptions.BooleanSubscription
155-
rx.subscriptions.CompositeSubscription
156-
rx.subscriptions.Subscriptions
157-
158-
*/
Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,6 @@
11
package rx.lang.scala
22

33
/**
4-
* Provides the type `Subject`.
4+
* Subjects are Observers and Observables at the same time.
55
*/
6-
package object subjects {
7-
8-
/**
9-
* A Subject is an Observable and an Observer at the same time.
10-
*
11-
* The Java Subject looks like this:
12-
* {{{
13-
* public abstract class Subject<T,R> extends Observable<R> implements Observer<T>
14-
* }}}
15-
*/
16-
type Subject[-T, +R] = rx.subjects.Subject[_ >: T, _ <: R]
17-
18-
// For nicer scaladoc, we would like to present something like this:
19-
/*
20-
trait Observable[+R] {}
21-
trait Observer[-T] {}
22-
trait Subject[-T, +R] extends Observable[R] with Observer[T] { }
23-
*/
24-
25-
// We don't make aliases to these types, because they are considered internal/not needed by users:
26-
// rx.subjects.AsyncSubject
27-
// rx.subjects.BehaviorSubject
28-
// rx.subjects.PublishSubject
29-
// rx.subjects.ReplaySubject
30-
31-
}
6+
package object subjects {}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package rx.lang.scala
2+
3+
/**
4+
* Provides `Subscription`, and specialized versions of it.
5+
*/
6+
package object subscriptions {}

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/subscriptions/scala.scala

Lines changed: 0 additions & 25 deletions
This file was deleted.

language-adaptors/rxjava-scala/src/main/scala/rx/lang/scala/util/util.scala

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)