public class Gen extends Object implements FileTypeDefinition, ResultDefinition, StartDefinition, RecordDefinition, FieldDefinition
| Modifier and Type | Method and Description |
|---|---|
FieldDefinition |
addField(String name,
Generator generator)
Adds a field to be generated.
|
ResultDefinition |
asCsv()
Sets the format to csv.
|
ResultDefinition |
asCsv(CsvSettings csvSettings)
Sets the format to csv with configuration options given by the specified settings object.
|
ResultDefinition |
asFixedWidth(FixedWidthSettings fixedWidthSettings)
Sets the format to be fixed width with configuration options given by the specified settings object.
|
FileTypeDefinition |
generate(int num)
Specifies how many records will be generated.
|
static StartDefinition |
start() |
File |
toFile(File file)
Saves the generated data to the specified File and returns it.
|
File |
toFile(String path)
Saves the generated date to a File specified by the path and returns it.
|
String |
toStringForm()
Returns the generated data as a String.
|
RecordDefinition |
use(Class<?> c)
Specifies a class that will be used to generate fields.
|
public static StartDefinition start()
public RecordDefinition use(Class<?> c)
StartDefinitionuse in interface StartDefinitionc - the class which the random data is to be generated forpublic FieldDefinition addField(String name, Generator generator)
StartDefinitionaddField in interface FieldDefinitionaddField in interface StartDefinitionname - String that names the fieldgenerator - Generator object that creates random values for the fieldpublic ResultDefinition asCsv()
FileTypeDefinitionasCsv in interface FileTypeDefinitionpublic ResultDefinition asCsv(CsvSettings csvSettings)
FileTypeDefinitionasCsv in interface FileTypeDefinitioncsvSettings - a CsvSettings object which configures how the csv is created such as whether or include a heading row.public ResultDefinition asFixedWidth(FixedWidthSettings fixedWidthSettings)
FileTypeDefinitionasFixedWidth in interface FileTypeDefinitionfixedWidthSettings - a FixedWidthSettings object that specifies the fixed width desiredpublic File toFile(File file)
ResultDefinitiontoFile in interface ResultDefinitionfile - a File where the generated data will be written topublic File toFile(String path)
ResultDefinitiontoFile in interface ResultDefinitionpath - The directory path where the file will be savedpublic String toStringForm()
ResultDefinitiontoStringForm in interface ResultDefinitionpublic FileTypeDefinition generate(int num)
RecordDefinitiongenerate in interface RecordDefinitionnum - the int defining how many rows will be generatedFileTypeDefinition which allows the specification of the type of file to createCopyright © 2017. All Rights Reserved.