com.google.cloud.dataflow.sdk.options

## Class PipelineOptionsFactory.Builder

- java.lang.Object
- - com.google.cloud.dataflow.sdk.options.PipelineOptionsFactory.Builder

Enclosing class:
  PipelineOptionsFactory

    public static class PipelineOptionsFactory.Builder
    extends Object

A fluent `PipelineOptions` builder.

### Method Summary

All Methods Instance Methods Concrete Methods
`<T extends PipelineOptions> T` `as(Class<T> klass)` Creates and returns an object that implements `<T>` using the values configured on this builder during construction.
`PipelineOptions` `create()` Creates and returns an object that implements `PipelineOptions` using the values configured on this builder during construction.
`PipelineOptionsFactory.Builder` `fromArgs(String[] args)` Sets the command line arguments to parse when constructing the `PipelineOptions`.
`PipelineOptionsFactory.Builder` `withoutStrictParsing()` During parsing of the arguments, we will skip over improperly formatted and unknown arguments.
`PipelineOptionsFactory.Builder` `withValidation()` After creation we will validate that `PipelineOptions` conforms to all the validation criteria from `<T>`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### fromArgs

    public PipelineOptionsFactory.Builder fromArgs(String[] args)

Sets the command line arguments to parse when constructing the `PipelineOptions`.

Example GNU style command line arguments:

       --project=MyProject (simple property, will set the "project" property to "MyProject")
       --readOnly=true (for boolean properties, will set the "readOnly" property to "true")
       --readOnly (shorthand for boolean properties, will set the "readOnly" property to "true")
       --x=1 --x=2 --x=3 (list style simple property, will set the "x" property to [1, 2, 3])
       --x=1,2,3 (shorthand list style simple property, will set the "x" property to [1, 2, 3])
       --complexObject='{"key1":"value1",...} (JSON format for all other complex types)

Simple properties are able to bound to `String`, `Class`, enums and Java primitives `boolean`, `byte`, `short`, `int`, `long`, `float`, `double` and their primitive wrapper classes.

Simple list style properties are able to be bound to `boolean[]`, `char[]`, `short[]`, `int[]`, `long[]`, `float[]`, `double[]`, `Class[]`, enum arrays, `String[]`, and `List<String>`.

JSON format is required for all other types.

By default, strict parsing is enabled and arguments must conform to be either `--booleanArgName` or `--argName=argValue`. Strict parsing can be disabled with `withoutStrictParsing()`. Empty or null arguments will be ignored whether or not strict parsing is enabled.

Help information can be output to `System.out` by specifying `--help` as an argument. After help is printed, the application will exit. Specifying only `--help` will print out the list of `registered options` by invoking `PipelineOptionsFactory.printHelp(PrintStream)`. Specifying `--help=PipelineOptionsClassName` will print out detailed usage information about the specifically requested PipelineOptions by invoking `PipelineOptionsFactory.printHelp(PrintStream, Class)`.

#### withValidation

    public PipelineOptionsFactory.Builder withValidation()

After creation we will validate that `PipelineOptions` conforms to all the validation criteria from `<T>`. See `PipelineOptionsValidator.validate(Class, PipelineOptions)` for more details about validation.

#### withoutStrictParsing

    public PipelineOptionsFactory.Builder withoutStrictParsing()

During parsing of the arguments, we will skip over improperly formatted and unknown arguments.

#### create

    public PipelineOptions create()

Creates and returns an object that implements `PipelineOptions` using the values configured on this builder during construction.

Returns:
  An object that implements `PipelineOptions`.

#### as

    public <T extends PipelineOptions> T as(Class<T> klass)

Creates and returns an object that implements `<T>` using the values configured on this builder during construction.

Note that `<T>` must be composable with every registered interface with this factory. See `PipelineOptionsFactory.validateWellFormed(Class, Set)` for more details.

Returns:
  An object that implements `<T>`.