1 package guru.mikelue.jdut.datagrain;
2
3 import java.util.function.Supplier;
4
5 /**
6 * Declares the interface to build a bunch of rows.
7 */
8 public interface RowsBuilder {
9 /**
10 * Sets the sequence of columns for implicit data.
11 *
12 * @param nameOfColumns The name of columns by sequence of varargs.
13 *
14 * @return cascading self
15 *
16 * @see #addValues(Object...)
17 */
18 public RowsBuilder implicitColumns(String... nameOfColumns);
19
20 /**
21 * Adds a row with values of fields.
22 *
23 * @param valuesOfField The values of field
24 *
25 * @return cascading self
26 */
27 public RowsBuilder addValues(Object... valuesOfField);
28 /**
29 * Adds a row with implicit data, the sequence of columns is defined by {@link #implicitColumns}.
30 *
31 * @param dataFields The object of {@link DataField}
32 *
33 * @return cascading self
34 *
35 * @see #implicitColumns
36 */
37 public RowsBuilder addFields(DataField<?>... dataFields);
38 /**
39 * Builds a data field.
40 *
41 * @param <T> the type of data for the field
42 * @param columnName The name of column
43 * @param fieldValue The value of field
44 *
45 * @return data field
46 *
47 * @see #addFields(DataField...)
48 */
49 public <T> DataField<T> newField(String columnName, T fieldValue);
50 /**
51 * Builds a data field by {@link Supplier}.
52 *
53 * @param <T> the type of data for the field
54 * @param columnName The name of column
55 * @param fieldSupplier The value of field
56 *
57 * @return data field
58 *
59 * @see #addFields(DataField...)
60 */
61 public <T> DataField<T> newField(String columnName, Supplier<T> fieldSupplier);
62 }