Package app.babylon.table.column
Interface ColumnObject<T>
- Type Parameters:
T- the runtime value type stored in the column
- All Superinterfaces:
Column
- All Known Subinterfaces:
ColumnCategorical<T>
- All Known Implementing Classes:
ColumnCategorical.Renamed,ColumnObject.Renamed
A column that stores object values, including strings, dates, decimals, and
other reference types.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilder for nullable object columns.static final recordstatic enumControls which physical representation should back an object column.static final classNested classes/interfaces inherited from interface app.babylon.table.column.Column
Column.KeyedValue, Column.Operator, Column.Type -
Method Summary
Modifier and TypeMethodDescriptiondefault voidappendTo(int i, StringBuilder out, ToStringSettings settings) Appends the value at the supplied row using the provided rendering settings.static ColumnObject.Builder<String> builder(ColumnName name) Creates aStringcolumn builder.static <T> ColumnObject.Builder<T> builder(ColumnName name, Column.Type type) Creates an object column builder using the default storage mode.static <T> ColumnObject.Builder<T> builder(ColumnName name, Column.Type type, ColumnObject.Mode mode) Creates an object column builder using the requested storage mode.static ColumnObject.Builder<BigDecimal> builderDecimal(ColumnName name) Creates aBigDecimalcolumn builder.default ColumnObject<T> copy(ColumnName x) Creates a copy of this object column with the supplied column name.default ColumnObject<T> copy(ColumnName x, RowPredicate include) Creates a copy of this column with the supplied column name, only retaining rows included by the supplied row predicate.static <T> booleanequals(ColumnObject<T> a, Object obj) Compares a column object with another object using column name, size, and row-by-row value equality.default Tfirst()Returns the first row value.default ColumnObject.KeyedObject<T> get(int i) Returns the value at the supplied row.default Collection<T> getAll(Collection<T> x) Appends all set values to the supplied collection.default ColumnObject.KeyedObject<T> getKeyedValue(int i) getUniques(Set<T> x) Collects the distinct set values from the column.default booleanisSet(int i) Indicates whether the value at the supplied row is present.default Tlast()Returns the last row value.default ColumnObject.KeyedObject<T> default Tmax()Returns the maximum set value in the column.default Tmin()Returns the minimum set value in the column.default RowPredicatepredicate(Column.Operator operator, CharSequence... values) Creates a row predicate by parsing the supplied comparison values according to this column's type.default RowPredicatepredicate(Column.Operator operator, T... values) Creates a row predicate from already-typed comparison values.default SelectionSelects rows whose values satisfy the supplied predicate.selectRow(int i) Returns a single-row object column containing the value from the supplied row.default StringtoString(int i, ToStringSettings settings) Formats the value at the supplied row using the provided rendering settings.default <S> ColumnObject<S> transform(Transformer<T, S> transformer) Transforms this column into another object column using the supplied transformer.Returns a projected view of this column using the supplied row mapping.
-
Method Details
-
builder
Creates an object column builder using the default storage mode.- Type Parameters:
T- the value type- Parameters:
name- the column nametype- the column type- Returns:
- a builder for the supplied object type
-
builder
static <T> ColumnObject.Builder<T> builder(ColumnName name, Column.Type type, ColumnObject.Mode mode) Creates an object column builder using the requested storage mode.- Type Parameters:
T- the value type- Parameters:
name- the column nametype- the column typemode- the preferred storage strategy- Returns:
- a builder for the supplied object type
-
builderDecimal
Creates aBigDecimalcolumn builder.- Parameters:
name- the column name- Returns:
- a decimal column builder
-
builder
Creates aStringcolumn builder.- Parameters:
name- the column name- Returns:
- a string column builder
-
copy
Creates a copy of this object column with the supplied column name. -
copy
Description copied from interface:ColumnCreates a copy of this column with the supplied column name, only retaining rows included by the supplied row predicate. -
selectRow
Returns a single-row object column containing the value from the supplied row. -
getKeyedValue
- Specified by:
getKeyedValuein interfaceColumn
-
firstKeyed
- Specified by:
firstKeyedin interfaceColumn
-
lastKeyed
-
view
Description copied from interface:ColumnReturns a projected view of this column using the supplied row mapping. -
get
Returns the value at the supplied row.- Parameters:
i- the zero-based row index- Returns:
- the row value, or
nullwhen unset
-
isSet
default boolean isSet(int i) Description copied from interface:ColumnIndicates whether the value at the supplied row is present. -
first
Returns the first row value.- Returns:
- the first row value
-
last
Returns the last row value.- Returns:
- the last row value
-
max
Returns the maximum set value in the column.- Returns:
- maximum set value
-
min
Returns the minimum set value in the column.- Returns:
- minimum set value
-
getAll
Appends all set values to the supplied collection.- Parameters:
x- the destination collection, ornull- Returns:
- a collection containing all set values in row order
-
getUniques
Collects the distinct set values from the column.- Parameters:
x- the destination set, ornull- Returns:
- a set containing the unique values
-
select
Selects rows whose values satisfy the supplied predicate.- Parameters:
f- the predicate to test against each set value- Returns:
- a selection containing the predicate result for each row
-
predicate
Description copied from interface:ColumnCreates a row predicate by parsing the supplied comparison values according to this column's type. -
predicate
Creates a row predicate from already-typed comparison values.This avoids the text parser used by
predicate(Operator, CharSequence...)for object types such asBigDecimal,LocalDate, orCurrency. ForColumnObject<String>, calls with string literals naturally bind to theCharSequence...overload becauseStringis aCharSequence; that is equivalent for string columns because parsing a string value as a string returns the same value.- Parameters:
operator- comparison operatorvalues- already-typed comparison values- Returns:
- predicate evaluated by row index
-
transform
Transforms this column into another object column using the supplied transformer.- Type Parameters:
S- the transformed value type- Parameters:
transformer- the row transformation to apply- Returns:
- a transformed column
-
toString
Description copied from interface:ColumnFormats the value at the supplied row using the provided rendering settings. -
appendTo
Description copied from interface:ColumnAppends the value at the supplied row using the provided rendering settings. -
equals
Compares a column object with another object using column name, size, and row-by-row value equality.- Type Parameters:
T- the column value type- Parameters:
a- the column to compareobj- the comparison target- Returns:
truewhen the objects represent the same column contents
-