public class PipelineOptionsFactory
extends java.lang.Object
PipelineOptions or any derived interface which is composable to any other
derived interface of PipelineOptions via the PipelineOptions.as(java.lang.Class<T>) method. Being
able to compose one derived interface of PipelineOptions to another has the following
restrictions:
PipelineOptions.
PipelineOptions must have a
getter and setter method.
PipelineOptions must be composable with every interface
registered with this factory.
See the JavaBeans specification for more details as to what constitutes a property.
| Modifier and Type | Class and Description |
|---|---|
static class |
PipelineOptionsFactory.Builder
A fluent PipelineOptions builder.
|
| Constructor and Description |
|---|
PipelineOptionsFactory() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends PipelineOptions> |
as(java.lang.Class<T> klass)
Creates and returns an object which implements
<T>. |
static PipelineOptions |
create()
Creates and returns an object which implements
PipelineOptions. |
static DataflowWorkerHarnessOptions |
createFromSystemProperties()
Deprecated.
|
static PipelineOptionsFactory.Builder |
fromArgs(java.lang.String[] args)
Sets the command line arguments to parse when constructing the
PipelineOptions. |
static java.util.Set<java.lang.Class<? extends PipelineOptions>> |
getRegisteredOptions() |
static void |
register(java.lang.Class<? extends PipelineOptions> iface)
This registers the interface with this factory.
|
PipelineOptionsFactory.Builder |
withValidation()
After creation we will validate that
PipelineOptions conforms to all the
validation criteria from <T>. |
public static PipelineOptions create()
PipelineOptions.
This sets the "appName" to the calling
classes simple name.PipelineOptions.public static <T extends PipelineOptions> T as(java.lang.Class<T> klass)
<T>.
This sets the "appName" to the calling
classes simple name.
Note that <T> must be composable with every registered interface with this factory.
See validateWellFormed(Class, Set) for more details.
<T>.public static PipelineOptionsFactory.Builder fromArgs(java.lang.String[] args)
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 property, will set the "x" property to [1, 2, 3]) --x=1,2,3 (shorthand list style property, will set the "x" property to [1, 2, 3])Properties are able to bound to
String and Java primitives boolean,
byte, short, int, long, float, double and
their primitive wrapper classes.
List style properties are able to be bound to boolean[], char[],
short[], int[], long[], float[], double[],
String[] and List<String>.
public PipelineOptionsFactory.Builder withValidation()
PipelineOptions conforms to all the
validation criteria from <T>. See
PipelineOptionsValidator.validate(Class, PipelineOptions) for more details about
validation.public static void register(java.lang.Class<? extends PipelineOptions> iface)
PipelineOptions.
PipelineOptions must have a
getter and setter method.
PipelineOptions must be composable with every interface
registered with this factory.
iface - The interface object to manually register.public static java.util.Set<java.lang.Class<? extends PipelineOptions>> getRegisteredOptions()
@Deprecated public static DataflowWorkerHarnessOptions createFromSystemProperties()
DataflowWorkerHarnessOptions based of a set of known system
properties. This is meant to only be used from the DataflowWorkerHarness as a method to
bootstrap the worker harness.DataflowWorkerHarnessOptions object configured for the
DataflowWorkerHarness.