Class PipelineOptionsFactory.Builder
- Enclosing class:
PipelineOptionsFactory
PipelineOptions builder.-
Method Summary
Modifier and TypeMethodDescription<T extends PipelineOptions>
TCreates and returns an object that implements<T>using the values configured on this builder during construction.create()Creates and returns an object that implementsPipelineOptionsusing the values configured on this builder during construction.Sets the command line arguments to parse when constructing thePipelineOptions.During parsing of the arguments, we will skip over improperly formatted and unknown arguments.After creation we will validate thatPipelineOptionsconforms to all the validation criteria from<T>.
-
Method Details
-
fromArgs
Sets the command line arguments to parse when constructing thePipelineOptions.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 primitivesboolean,byte,short,int,long,float,doubleand 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[], andList<String>.JSON format is required for all other types.
By default, strict parsing is enabled and arguments must conform to be either
--booleanArgNameor--argName=argValue. Strict parsing can be disabled withwithoutStrictParsing(). Empty or null arguments will be ignored whether or not strict parsing is enabled.Help information can be output to
System.outby specifying--helpas an argument. After help is printed, the application will exit. Specifying only--helpwill print out the list ofregistered optionsby invokingPipelineOptionsFactory.printHelp(PrintStream). Specifying--help=PipelineOptionsClassNamewill print out detailed usage information about the specifically requested PipelineOptions by invokingPipelineOptionsFactory.printHelp(PrintStream, Class). -
withValidation
After creation we will validate thatPipelineOptionsconforms to all the validation criteria from<T>. SeePipelineOptionsValidator.validate(Class, PipelineOptions)for more details about validation. -
withoutStrictParsing
During parsing of the arguments, we will skip over improperly formatted and unknown arguments. -
create
Creates and returns an object that implementsPipelineOptionsusing the values configured on this builder during construction.- Returns:
- An object that implements
PipelineOptions.
-
as
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. SeePipelineOptionsFactory.Cache.validateWellFormed(Class)for more details.- Returns:
- An object that implements
<T>.
-