PipelineOptions are used to configure Pipelines. You can extend PipelineOptions
to create custom configuration options specific to your Pipeline,
for both local execution and execution via a PipelineRunner.

PipelineOptions and their subinterfaces represent a collection of properties
which can be manipulated in a type safe manner. PipelineOptions is backed by a
dynamic Proxy which allows for type safe manipulation of properties in an extensible
fashion through plain old Java interfaces.

// The most common way to construct PipelineOptions is via command-line argument parsing:
public static void main(String[] args) {
// Will parse the arguments passed into the application and construct a PipelineOptions
// Note that --help will print registered options, and --help=PipelineOptionsClassName
// will print out usage for the specific class.
PipelineOptions options =
PipelineOptionsFactory.fromArgs(args).create();
Pipeline p = Pipeline.create(options);
...
p.run();
}
// To create options for the DirectRunner:
DirectOptions directRunnerOptions =
PipelineOptionsFactory.as(DirectOptions.class);
// To cast from one type to another using the as(Class) method:
ApplicationNameOptions applicationNameOptions =
directPipelineOptions.as(ApplicationNameOptions.class);
// Options for the same property are shared between types
// The statement below will print out the name of the enclosing class by default
System.out.println(applicationNameOptions.getApplicationName());
// Prints out registered options.
PipelineOptionsFactory.printHelp(System.out);
// Prints out options which are available to be set on ApplicationNameOptions
PipelineOptionsFactory.printHelp(System.out, ApplicationNameOptions.class);

Defining Your Own PipelineOptions

Defining your own PipelineOptions is the way for you to make configuration
options available for both local execution and execution via a PipelineRunner.
By having PipelineOptionsFactory as your command-line interpreter, you will provide
a standardized way for users to interact with your application via the command-line.

Annotations For PipelineOptions

@Default represents a set of annotations that can be used to annotate getter
properties on PipelineOptions with information representing the default value to be
returned if no value is specified. Any default implementation (using the default keyword)
is ignored.

Note: It is an error to have the same property available in multiple interfaces with only
some of them being annotated with @JsonIgnore. It is also an error to mark a
setter for a property with @JsonIgnore.