Class ColumnDescriptor<T,C extends tech.tablesaw.columns.Column<T>>
java.lang.Object
com.lumiomedical.etl.dataframe.descriptor.ColumnDescriptor<T,C>
public final class ColumnDescriptor<T,C extends tech.tablesaw.columns.Column<T>> extends Object
This class is expected to simplify the signature of other classes interacting with tablesaw Columns and Rows by providing a centralized "repository" of references to Column-related methods.
These methods have type-sensitive names and can be "hard" to abstract away ; eg. in order to abstract both the creation of a column and its subsequent modification within a row, you need to know which factory method and which setter to call.
By having these singleton descriptors, one can create simpler class signatures that simply request a coherent set of references.
Before these, we had to manually require Function and BiFunction of all sorts in TableProcessor implementations, which was rather confusing and got out of hand very quickly.
At the time of this writing, the class has a private constructor, but this could be modified if it turns out we want to allow for custom column types or custom descriptors.
- Author:
- Pierre Lecerf ([email protected]) Created on 2020/08/14
-
Field Summary
Fields Modifier and Type Field Description static ColumnDescriptor<Boolean,tech.tablesaw.api.BooleanColumn>
BOOLEAN
static ColumnDescriptor<Double,tech.tablesaw.api.DoubleColumn>
DOUBLE
static ColumnDescriptor<Float,tech.tablesaw.api.FloatColumn>
FLOAT
static ColumnDescriptor<Instant,tech.tablesaw.api.InstantColumn>
INSTANT
static ColumnDescriptor<Integer,tech.tablesaw.api.IntColumn>
INTEGER
static ColumnDescriptor<Long,tech.tablesaw.api.LongColumn>
LONG
static ColumnDescriptor<Short,tech.tablesaw.api.ShortColumn>
SHORT
static ColumnDescriptor<String,tech.tablesaw.api.StringColumn>
STRING
static ColumnDescriptor<String,tech.tablesaw.api.TextColumn>
TEXT
-
Method Summary
Modifier and Type Method Description tech.tablesaw.columns.Column<T>
createColumn(String columnName, int rowCount)
static ColumnDescriptor
forType(tech.tablesaw.api.ColumnType type)
tech.tablesaw.columns.Column<T>
getColumn(tech.tablesaw.api.Table table, String name)
Class<C>
getColumnType()
tech.tablesaw.api.ColumnType
getType()
T
getValue(tech.tablesaw.api.Row row, String columnName)
void
setValue(tech.tablesaw.api.Row row, String columnName, T value)
-
Field Details
-
Method Details
-
forType
- Parameters:
type
-- Returns:
-
getType
public tech.tablesaw.api.ColumnType getType()- Returns:
-
getColumnType
- Returns:
-
getColumn
- Parameters:
table
-name
-- Returns:
-
createColumn
- Parameters:
columnName
-rowCount
-- Returns:
-
getValue
- Parameters:
row
-columnName
-- Returns:
-
setValue
- Parameters:
row
-columnName
-value
-
-