Package app.babylon.table.column
Interface ColumnCategorical.Builder<T>
- Type Parameters:
T- the value type
- All Superinterfaces:
Column.Builder,ColumnObject.Builder<T>
- Enclosing interface:
ColumnCategorical<T>
Builder for dictionary-encoded categorical columns.
-
Method Summary
Modifier and TypeMethodDescriptionAppends a value to the column.addNull()Appends an unset row.build()Materialises the current builder contents as an immutable column.build(Column.Type transformedType) Builds the categorical column by parsing each distinct source value through the supplied target type parser.Methods inherited from interface app.babylon.table.column.ColumnObject.Builder
add, getName, getType, size
-
Method Details
-
add
Description copied from interface:ColumnObject.BuilderAppends a value to the column.- Specified by:
addin interfaceColumnObject.Builder<T>- Parameters:
x- the value to append, which may benull- Returns:
- this builder
-
addNull
ColumnCategorical.Builder<T> addNull()Description copied from interface:ColumnObject.BuilderAppends an unset row.- Specified by:
addNullin interfaceColumnObject.Builder<T>- Returns:
- this builder
-
build
ColumnCategorical<T> build()Description copied from interface:Column.BuilderMaterialises the current builder contents as an immutable column.- Specified by:
buildin interfaceColumn.Builder- Specified by:
buildin interfaceColumnObject.Builder<T>- Returns:
- the built column
-
build
Builds the categorical column by parsing each distinct source value through the supplied target type parser. This is the natural path for building a typed categorical column from a string-like categorical builder when the target parser may still need to construct aString. The categorical dictionary can be parsed once during materialisation, rather than first building an immutableColumnCategorical<String>and then transforming that immutable column afterward. This is therefore preferred overbuild()followed byColumnCategorical.transform(Transformer)when the target values come from parsing the source categorical strings, because the parse work can be done during the build and the intermediate immutable string categorical column can be avoided. If the supplied target type is the same as the builder type, this behaves likebuild()and returns the categorical column directly.- Specified by:
buildin interfaceColumnObject.Builder<T>- Parameters:
transformedType- the target column type- Returns:
- an immutable categorical column of the transformed type
-