Skip to content

Commit 32b00cc

Browse files
committed
License and README
1 parent 0f785d7 commit 32b00cc

File tree

6 files changed

+133
-15
lines changed

6 files changed

+133
-15
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Kotlin Adaptor for RxJava
2+
3+
Kotlin has support for SAM (Single Abstract Method) Interfaces as Functions (i.e. Java 8 Lambdas). So you could use Kotlin in RxJava whitout this adaptor
4+
5+
```kotlin
6+
Observable.create<String>{ observer ->
7+
observer!!.onNext("Hello")
8+
observer.onCompleted()
9+
Subscriptions.empty()
10+
}!!.subscribe { result ->
11+
a!!.received(result)
12+
}
13+
```
14+
15+
This adaptor exposes a set of Extension functions that allow a more idiomatic Kotlin usage
16+
17+
```kotlin
18+
import rx.lang.kotlin.*
19+
20+
{(observer: Observer<in String>) ->
21+
observer.onNext("Hello")
22+
observer.onCompleted()
23+
Subscriptions.empty()!!
24+
}.asObservable().subscribe { result ->
25+
a!!.received(result)
26+
}
27+
```
28+
29+
## Binaries
30+
31+
Binaries and dependency information for Maven, Ivy, Gradle and others can be found at [http://search.maven.org](http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22rxjava-kotlin%22).
32+
33+
Example for Maven:
34+
35+
```xml
36+
<dependency>
37+
<groupId>com.netflix.rxjava</groupId>
38+
<artifactId>rxjava-kotlin</artifactId>
39+
<version>x.y.z</version>
40+
</dependency>
41+
```
42+
43+
and for Ivy:
44+
45+
```xml
46+
<dependency org="com.netflix.rxjava" name="rxjava-kotlin" rev="x.y.z" />
47+
```
48+
49+
and for Gradle:
50+
51+
```groovy
52+
compile 'com.netflix.rxjava:rxjava-kotlin:x.y.z'
53+
```

language-adaptors/rxjava-kotlin/src/examples/kotlin/rx/lang/kotlin/examples/namespace.kt

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2013 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+
117
package rx.lang.kotlin.examples
218

319
import rx.Observable
@@ -9,13 +25,6 @@ import rx.Subscription
925
import java.net.URL
1026
import java.util.Scanner
1127

12-
/**
13-
* Created by IntelliJ IDEA.
14-
* @author Mario Arias
15-
* Date: 28/09/13
16-
* Time: 3:00
17-
*/
18-
1928
fun main(args: Array<String>) {
2029
hello(array("Ben", "George"))
2130
customObservableNonBlocking().subscribe { println(it) }

language-adaptors/rxjava-kotlin/src/examples/kotlin/rx/lang/kotlin/examples/video/namespace.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2013 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+
117
package rx.lang.kotlin.examples.video
218

319
import rx.Observable

language-adaptors/rxjava-kotlin/src/main/kotlin/rx/lang/kotlin/namespace.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2013 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+
117
package rx.lang.kotlin
218

319
import rx.Subscription

language-adaptors/rxjava-kotlin/src/test/kotlin/rx/lang/kotlin/BasicKotlinTests.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2013 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+
117
package rx.lang.kotlin
218

319
import org.mockito.Mock

language-adaptors/rxjava-kotlin/src/test/kotlin/rx/lang/kotlin/ExtensionTests.kt

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2013 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+
117
package rx.lang.kotlin
218

319
import org.mockito.Mock
@@ -128,14 +144,6 @@ public class ExtensionTests {
128144

129145
[Test]
130146
public fun testScriptWithMerge() {
131-
val factory = TestFactory()
132-
Observable.merge(factory.observable, factory.observable)!!.subscribe((received()))
133-
verify(a, times(1))!!.received("hello_1")
134-
verify(a, times(1))!!.received("hello_2")
135-
}
136-
137-
[Test]
138-
public fun testScriptWithMergeEx() {
139147
val factory = TestFactory()
140148
(factory.observable to factory.observable).merge().subscribe((received()))
141149
verify(a, times(1))!!.received("hello_1")

0 commit comments

Comments
 (0)