1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
import java.io.Serializable;
public class Issue3032 {
public static class PCollection<T> implements PValue {
public <OutputT extends POutput> OutputT apply(
String name, PTransform<? super PCollection<T>, OutputT> t) {
throw new RuntimeException();
}
}
public abstract static class PTransform<InputT extends PInput, OutputT extends POutput> {}
interface PInput {}
interface POutput {}
interface PValue extends PInput, POutput {}
static class BillingEvent {
InvoiceGroupingKey getInvoiceGroupingKey() {
throw new RuntimeException();
}
}
public static class MapElements<InputT, OutputT>
extends PTransform<PCollection<? extends InputT>, PCollection<OutputT>> {
public static <InputT, OutputT> MapElements<InputT, OutputT> via(
final ProcessFunction<InputT, OutputT> fn) {
throw new RuntimeException();
}
}
static class InvoiceGroupingKey {}
@FunctionalInterface
public interface ProcessFunction<InputT, OutputT> extends Serializable {
OutputT apply(InputT input) throws Exception;
}
private static class GenerateInvoiceRows
extends PTransform<PCollection<BillingEvent>, PCollection<String>> {
public void expand(PCollection<BillingEvent> input) {
input.apply(
"Map to invoicing key", MapElements.via(BillingEvent::getInvoiceGroupingKey));
}
}
}
|