Access side input in a non - anonymous DoFn

Viewed 1825

How to access the elements of a side input if I have my class extend DoFn?

For example:

Say I have a ParDo transform like:

PCollection<String> data = myData.apply("Get data",
    ParDo.of(new MyClass()).withSideInputs(myDataView));

And I have a class:-

static class MyClass extends DoFn<String,String>
{
    //How to access side input here
}

c.sideInput() isn't working in this case.

Thanks.

2 Answers
Related