Skip to content

Commit

Permalink
reactive
Browse files Browse the repository at this point in the history
  • Loading branch information
tanghanzheng committed Oct 9, 2023
1 parent d11324c commit d96c0d9
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.github.linyuzai.reactive.core.concept;

public interface ReactiveCollection {
public interface ReactiveCollection<T> {

interface Factory {

<T> ReactiveCollection<T> empty();
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
package com.github.linyuzai.reactive.reactor.concept;

import com.github.linyuzai.reactive.core.concept.ReactiveCollection;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import reactor.core.publisher.Flux;

public class ReactorCollection<T> implements ReactiveCollection {
@Getter
@RequiredArgsConstructor
public class ReactorCollection<T> implements ReactiveCollection<T> {

private Flux<T> flux;
private final Flux<T> flux;

public static class FluxFactory implements Factory {

@Override
public <T> ReactiveCollection<T> empty() {
return new ReactorCollection<>(Flux.empty());
}
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package com.github.linyuzai.reactive.reactor.concept;

import com.github.linyuzai.reactive.core.concept.ReactiveObject;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import reactor.core.publisher.Mono;

import java.util.concurrent.Callable;
import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;

@Getter
@AllArgsConstructor
@RequiredArgsConstructor
public class ReactorObject<T> implements ReactiveObject<T> {

private Mono<T> mono;
private final Mono<T> mono;

public static class MonoFactory implements Factory {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@

import com.github.linyuzai.reactive.core.concept.ReactiveCollection;
import io.reactivex.rxjava3.core.Flowable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

public class RxJava3Collection<T> implements ReactiveCollection {
@Getter
@RequiredArgsConstructor
public class RxJava3Collection<T> implements ReactiveCollection<T> {

private Flowable<T> flowable;
private final Flowable<T> flowable;

public static class FlowableFactory implements Factory {

@Override
public <T> ReactiveCollection<T> empty() {
return new RxJava3Collection<>(Flowable.empty());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

import com.github.linyuzai.reactive.core.concept.ReactiveObject;
import io.reactivex.rxjava3.core.Maybe;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.concurrent.Callable;
import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;

@Getter
@AllArgsConstructor
@RequiredArgsConstructor
public class RxJava3Object<T> implements ReactiveObject<T> {

private Maybe<T> maybe;
private final Maybe<T> maybe;

public static class MaybeFactory implements Factory {

Expand Down

0 comments on commit d96c0d9

Please sign in to comment.