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

com.github.davidmoten.rx.jdbc.QueryUpdateOperatorFromObservable Maven / Gradle / Ivy

There is a newer version: 0.7.19
Show newest version
package com.github.davidmoten.rx.jdbc;

import rx.Observable;
import rx.Observable.Operator;
import rx.Subscriber;
import rx.functions.Func1;

import com.github.davidmoten.rx.OperationToOperator;

/**
 * {@link Operator} corresonding to {@link QueryUpdateOperation}.
 */
class QueryUpdateOperatorFromObservable implements Operator, Observable> {

    private final OperationToOperator, Observable> operator;

    /**
     * Constructor.
     * 
     * @param builder
     * @param operatorType
     */
    QueryUpdateOperatorFromObservable(final QueryUpdate.Builder builder) {
        operator = new OperationToOperator, Observable>(
                new Func1>, Observable>>() {

                    @Override
                    public Observable> call(Observable> observable) {

                        return observable.map(new Func1, Observable>() {
                            @Override
                            public Observable call(Observable parameters) {
                                return builder.clearParameters().parameters(parameters).count();
                            }
                        });
                    }
                });
    }

    @Override
    public Subscriber> call(Subscriber> subscriber) {
        return operator.call(subscriber);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy