All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cyclops.monads.Rx2Witness Maven / Gradle / Ivy

There is a newer version: 10.4.0
Show newest version
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();
        }

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy