/** * Perform common validations of the {@link DoFn} against the input {@link PCollection}, for * example ensuring that the window type expected by the {@link DoFn} matches the window type of * the {@link PCollection}. */ private static <InputT, OutputT> void validateWindowType( PCollection<? extends InputT> input, DoFn<InputT, OutputT> fn) { DoFnSignature signature = DoFnSignatures.getSignature((Class) fn.getClass()); TypeDescriptor<? extends BoundedWindow> actualWindowT = input.getWindowingStrategy().getWindowFn().getWindowTypeDescriptor(); validateWindowTypeForMethod(actualWindowT, signature.processElement()); for (OnTimerMethod method : signature.onTimerMethods().values()) { validateWindowTypeForMethod(actualWindowT, method); } }