Skip to content

Add utility method to convert a Transformer to an Operator #2865

@davidmoten

Description

@davidmoten

I have a documented API for rxjava-jdbc that suggests certain special operations to be performed using the Observable.lift method with custom Operators. Works fine but if internally I decide to use a composition of existing operators instead of a custom operator then I need the ability to convert a Transformer into an Operator so that the documented use of the API does not need to change. I'd suggest the addition of a Transformers utility class and supporting classes:

public final class Transformers {

    public static <T,R> Operator<R,T> toOperator(Transformer<T,R> transformer) {
        return TransformerOperator.toOperator(transformer);
    }

}

I have the code for this and tests resident in rxjava-jdbc and can contribute it if there is support. Are people happy for me to proceed with a PR?

Incidentally, Operator -> Transformer is a trivial conversion, it is just the Transformer -> Operator conversion that the suggested PR could facilitate.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions