com.github.davidmoten.rx.jdbc.QuerySelectTransformer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rxjava-jdbc Show documentation
Show all versions of rxjava-jdbc Show documentation
rx-java Observables for jdbc
package com.github.davidmoten.rx.jdbc;
import com.github.davidmoten.rx.jdbc.QuerySelect.Builder;
import rx.Observable;
import rx.Observable.Transformer;
import rx.functions.Func1;
/**
* Transformer corresponding to the QuerySelectOperation.
*
* @param
*/
final class QuerySelectTransformer implements Transformer {
private final Builder builder;
private final ResultSetMapper extends T> function;
private final OperatorType operatorType;
/**
* Constructor.
*
* @param builder
* @param function
* @param operatorType
* @param resultSetTransform
*/
QuerySelectTransformer(final QuerySelect.Builder builder,
final ResultSetMapper extends T> function, final OperatorType operatorType) {
this.builder = builder;
this.function = function;
this.operatorType = operatorType;
}
@Override
public Observable call(Observable source) {
if (operatorType == OperatorType.PARAMETER)
return builder.parameters(source).get(function);
else if (operatorType == OperatorType.DEPENDENCY)
// dependency
return builder.dependsOn(source).get(function);
else // PARAMETER_LIST
{
@SuppressWarnings("unchecked")
Observable> obs = (Observable>) source;
return obs.concatMap(new Func1, Observable>() {
@Override
public Observable call(Observable
© 2015 - 2025 Weber Informatics LLC | Privacy Policy