Class FlatFileGenerator.Builder
java.lang.Object
io.bloviate.file.FlatFileGenerator.Builder
- Enclosing class:
FlatFileGenerator
Builds a
FlatFileGenerator, defaulting to CSV output and 1000 rows with no columns.- Author:
- Tim Veil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(ColumnDefinition columnDefinition) Appends a single column definition to the existing list of columns.addAll(List<ColumnDefinition> columnDefinitions) Replaces the column definitions with the supplied list.build()Builds a newFlatFileGeneratorfrom this builder's configuration.output(FileDefinition fileDefinition) Sets the output file format definition.rows(long rows) Sets the number of data rows to generate, excluding the header row.
-
Constructor Details
-
Builder
Creates a builder for the given base output file name (the extension is added per output format).- Parameters:
fileName- the base file name, without extension
-
-
Method Details
-
output
Sets the output file format definition. Defaults toCsvFile(CSV output) when not specified.- Parameters:
fileDefinition- the file format definition controlling the delimiter and extension- Returns:
- this builder, for chaining
-
addAll
Replaces the column definitions with the supplied list. The columns are written in the order given, one delimited field per column.- Parameters:
columnDefinitions- the column definitions to use- Returns:
- this builder, for chaining
-
add
Appends a single column definition to the existing list of columns.- Parameters:
columnDefinition- the column definition to append- Returns:
- this builder, for chaining
-
rows
Sets the number of data rows to generate, excluding the header row. Defaults to1000when not specified.- Parameters:
rows- the number of data rows to write- Returns:
- this builder, for chaining
-
build
Builds a newFlatFileGeneratorfrom this builder's configuration.- Returns:
- a configured
FlatFileGenerator
-