| Class | Line # | Actions | |||||
|---|---|---|---|---|---|---|---|
| TupleAccessor | 9 | 0 | - | 0 | 0 |
| 1 | package guru.mikelue.foxglove; | |
| 2 | ||
| 3 | import java.util.List; | |
| 4 | import java.util.Map; | |
| 5 | ||
| 6 | /** | |
| 7 | * Easy to be used for auto-casting on values of a tuple. | |
| 8 | */ | |
| 9 | public interface TupleAccessor { | |
| 10 | /** | |
| 11 | * Gets the value of a column with auto-casting. | |
| 12 | * | |
| 13 | * @param <T> Expected type of the column | |
| 14 | * @param name Name of the column | |
| 15 | * | |
| 16 | * @return Value of the column | |
| 17 | * | |
| 18 | * @throws ClassCastException When the value cannot be casted to the expected type | |
| 19 | * @throws IllegalArgumentException When the column name is not existing | |
| 20 | * | |
| 21 | * @see #setValue(String, Object) | |
| 22 | */ | |
| 23 | <T> T getValue(String name); | |
| 24 | ||
| 25 | /** | |
| 26 | * Sets the value of a column. | |
| 27 | * | |
| 28 | * @param <T> Type of the value | |
| 29 | * @param name Name of the column | |
| 30 | * @param value Value to be set | |
| 31 | * | |
| 32 | * @throws IllegalArgumentException When the column name is not existing | |
| 33 | * | |
| 34 | * @see #getValue(String) | |
| 35 | */ | |
| 36 | <T> void setValue(String name, T value); | |
| 37 | ||
| 38 | /** | |
| 39 | * Checks whether or not the generated row has the given column. | |
| 40 | * | |
| 41 | * @param name Name of the column | |
| 42 | * | |
| 43 | * @return true if the generated row has the given column; false otherwise | |
| 44 | */ | |
| 45 | boolean hasColumn(String name); | |
| 46 | ||
| 47 | /** | |
| 48 | * Gets metadata of all columns of the generated row. | |
| 49 | * | |
| 50 | * @return List of ColumnMeta of all columns | |
| 51 | */ | |
| 52 | List<ColumnMeta> getMetaOfColumns(); | |
| 53 | ||
| 54 | /** | |
| 55 | * Gets all columns as a map. | |
| 56 | * | |
| 57 | * @return read-only Map with duplicated column names and their values | |
| 58 | */ | |
| 59 | Map<ColumnMeta, Object> asMap(); | |
| 60 | ||
| 61 | /** | |
| 62 | * Gets the index(starts with {@code 0}) for the {@link TableFacet}. | |
| 63 | * | |
| 64 | * @return Index for of generated rows on the TableFacet | |
| 65 | */ | |
| 66 | int index(); | |
| 67 | } |