public class TupleBuilder extends Object
Tuple t = new TupleBuilder().build();
You can use the csv or json primitive to easily read in your configuration or resource files:
Tuple t = new TupleBuilder()
.fromCsv("london;ted\nparis;phil"))
.csvDelimiter(";")
.csvColumns(Arrays.asList(new String[]{ "city", "user"}))
.build();
Constructor and Description |
---|
TupleBuilder()
Ctor.
|
Modifier and Type | Method and Description |
---|---|
Tuple |
build() |
TupleBuilder |
csvColumns(List<String> columns) |
TupleBuilder |
csvDelimiter(String delimiter)
Set the csv delimiter
|
TupleBuilder |
fromCsv(String csv) |
TupleBuilder |
fromJson(String json) |
TupleBuilder |
inferTypes()
Guess the type of the csv columns.
|
TupleBuilder |
lowerCaseKeys()
Request all csv columns lower cases
|
public TupleBuilder fromCsv(String csv)
csv
- a csv stringpublic TupleBuilder fromJson(String json)
json
- a json stringpublic TupleBuilder csvColumns(List<String> columns)
columns
- provide the csv columnspublic TupleBuilder inferTypes()
public TupleBuilder lowerCaseKeys()
public TupleBuilder csvDelimiter(String delimiter)
delimiter
- public Tuple build()
Copyright © 2023. All rights reserved.