cyclops.monads.Rx2Witness Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cyclops-rx2-integration Show documentation
Show all versions of cyclops-rx2-integration Show documentation
Cyclops integration with RxJava 2
package cyclops.monads;
import com.oath.cyclops.anym.extensability.MonadAdapter;
import com.oath.cyclops.rx2.adapter.*;
import io.reactivex.Flowable;
import io.reactivex.Maybe;
import io.reactivex.Observable;
import io.reactivex.Single;
public interface Rx2Witness {
public static Maybe maybe(AnyM anyM){
return anyM.unwrap();
}
static interface MaybeWitness> extends WitnessType {
}
public static enum maybe implements MaybeWitness {
INSTANCE;
@Override
public MonadAdapter adapter() {
return new MaybeAdapter();
}
}
public static Flowable flowable(AnyM anyM){
FlowableReactiveSeqImpl obs = anyM.unwrap();
return obs.getFlowable();
}
static interface FlowableWitness> extends WitnessType {
}
public static enum flowable implements FlowableWitness {
INSTANCE;
@Override
public MonadAdapter adapter() {
return new FlowableAdapter();
}
}
public static Single single(AnyM anyM){
return anyM.unwrap();
}
static interface SingleWitness> extends WitnessType {
}
public static enum single implements SingleWitness {
INSTANCE;
@Override
public MonadAdapter adapter() {
return new SingleAdapter();
}
}
public static Observable observable(AnyM anyM){
ObservableReactiveSeqImpl obs = anyM.unwrap();
return obs.getObservable();
}
static interface ObservableWitness> extends WitnessType {
}
public static enum observable implements ObservableWitness {
INSTANCE;
@Override
public MonadAdapter adapter() {
return new ObservableAdapter();
}
}
}