# castFrom<SS, ST, TS, TT> method

StreamTransformer<TS, TT> castFrom <SS, ST, TS, TT>(StreamTransformer<SS, ST> source)

Adapts `source` to be a `StreamTransformer<TS, TT>`.

This allows `source` to be used at the new type, but at run-time it must satisfy the requirements of both the new type and its original type.

Data events passed into the returned transformer must also be instances of `SS`, and data events produced by `source` for those events must also be instances of `TT`.

## Implementation

    static StreamTransformer<TS, TT> castFrom<SS, ST, TS, TT>(
        StreamTransformer<SS, ST> source) {
      return new CastStreamTransformer<SS, ST, TS, TT>(source);
    }