Skip to content

Commit

Permalink
Rename RxJava8Utils methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ygree committed Aug 14, 2018
1 parent 919d274 commit 8b0c055
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions couchbase/src/main/java/utils/RxJava8Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.concurrent.CompletableFuture;

public class RxJava8Utils {
public static <T> CompletableFuture<List<T>> fromObservable(Observable<T> observable) {
public static <T> CompletableFuture<List<T>> fromMultiple(Observable<T> observable) {
final CompletableFuture<List<T>> future = new CompletableFuture<>();
observable
.doOnError(future::completeExceptionally)
Expand All @@ -16,7 +16,7 @@ public static <T> CompletableFuture<List<T>> fromObservable(Observable<T> observ
return future;
}

public static <T> CompletableFuture<T> fromSingleObservable(Observable<T> observable) {
public static <T> CompletableFuture<T> fromSingle(Observable<T> observable) {
final CompletableFuture<T> future = new CompletableFuture<>();
observable
.doOnError(future::completeExceptionally)
Expand All @@ -25,7 +25,7 @@ public static <T> CompletableFuture<T> fromSingleObservable(Observable<T> observ
return future;
}

public static <T> CompletableFuture<Optional<T>> fromSingleOptObservable(Observable<T> observable) {
public static <T> CompletableFuture<Optional<T>> fromNullable(Observable<T> observable) {
final CompletableFuture<Optional<T>> future = new CompletableFuture<>();
observable
.map(Optional::ofNullable)
Expand All @@ -35,7 +35,7 @@ public static <T> CompletableFuture<Optional<T>> fromSingleOptObservable(Observa
return future;
}

public static <T> CompletableFuture<Optional<T>> fromSingleOptOptObservable(Observable<Optional<T>> observable) {
public static <T> CompletableFuture<Optional<T>> fromOptional(Observable<Optional<T>> observable) {
final CompletableFuture<Optional<T>> future = new CompletableFuture<>();
observable
.doOnError(future::completeExceptionally)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public CompletionStage<Done> updateMessage(String name, String message) {
.insert(doc).map(x -> Done.getInstance())
.onErrorResumeNext(e -> bucket.query(query).map(x -> Done.getInstance()));

return RxJava8Utils.fromSingleObservable(result);
return RxJava8Utils.fromSingle(result);
}

private String userMessageDocId(String name) {
Expand All @@ -63,7 +63,7 @@ public CompletionStage<Optional<String>> getMessage(String name) {
.get(docId)
.map(v -> Optional.ofNullable(v.content().getString("message")));

return RxJava8Utils.fromSingleOptOptObservable(result);
return RxJava8Utils.fromOptional(result);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public CompletionStage<Offset> getOffset(AggregateEventTag<HelloEvent> tag) {
.map(uid -> ((Offset) new Offset.TimeBasedUUID(uid)))
);

return RxJava8Utils.fromSingleOptOptObservable(result).thenApply(v -> v.orElse(Offset.NONE));
return RxJava8Utils.fromOptional(result).thenApply(v -> v.orElse(Offset.NONE));
}

public CompletionStage<Done> updateOffset(AggregateEventTag<HelloEvent> tag, Offset offset) {
Expand All @@ -59,7 +59,7 @@ public CompletionStage<Done> updateOffset(AggregateEventTag<HelloEvent> tag, Off
.upsert(doc)
.map(b -> Done.getInstance());

return RxJava8Utils.fromSingleObservable(result);
return RxJava8Utils.fromSingle(result);
}

private String offsetDocId(AggregateEventTag<HelloEvent> tag) {
Expand All @@ -84,7 +84,7 @@ public CompletionStage<Done> updateMessage(String name, String message) {
.insert(doc).map(x -> Done.getInstance())
.onErrorResumeNext(e -> bucket.query(query).map(x -> Done.getInstance()));

return RxJava8Utils.fromSingleObservable(result);
return RxJava8Utils.fromSingle(result);
}

private String userMessageDocId(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public CompletionStage<Done> updateMessage(String name, String message) {
.insert(doc).map(x -> Done.getInstance())
.onErrorResumeNext(e -> bucket.query(query).map(x -> Done.getInstance()));

return RxJava8Utils.fromSingleObservable(result);
return RxJava8Utils.fromSingle(result);
}

private String userMessageDocId(String name) {
Expand All @@ -61,7 +61,7 @@ public CompletionStage<Optional<String>> getMessage(String name) {
.get(docId)
.map(v -> Optional.ofNullable(v.content().getString("message")));

return RxJava8Utils.fromSingleOptOptObservable(result);
return RxJava8Utils.fromOptional(result);
}
}

0 comments on commit 8b0c055

Please sign in to comment.