class PipelineRunner {

  public static PipelineRunner<? extends PipelineResult> fromOptions(PipelineOptions options) {
    checkNotNull(options);
    PipelineOptionsValidator.validate(PipelineOptions.class, options);

    // (Re-)register standard IO factories. Clobbers any prior credentials.
    IOChannelUtils.registerIOFactoriesAllowOverride(options);
    FileSystems.setDefaultConfigInWorkers(options);

    @SuppressWarnings("unchecked")
    PipelineRunner<? extends PipelineResult> result =
        InstanceBuilder.ofType(PipelineRunner.class)
        .fromClass(options.getRunner())
        .fromFactoryMethod("fromOptions")
        .withArg(PipelineOptions.class, options)
        .build();
    return result;
  }

}