Interface Row.SimpleBuilder
-
- All Known Implementing Classes:
SimpleBuilders.RowBuilder
- Enclosing interface:
- Row
public static interface Row.SimpleBuilder
Row builder interface geared towards human.Where the
Row.Builder
deals with building rows efficiently from internal objects (Cell
,LivenessInfo
, ...), theSimpleBuilder
is geared towards building rows from string column name and 'native' values (string for text, ints for numbers, et...). In particular, it is meant to be convenient, not efficient, and should be used only in place where performance is not of the utmost importance (it is used to build schema mutation for instance).Also note that contrarily to
Row.Builder
, theSimpleBuilder
API has nonewRow()
method: it is expected that the clustering of the row built is provided by the constructor of the builder.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Row.SimpleBuilder
add(java.lang.String columnName, java.lang.Object value)
Adds a value to a given column.Row.SimpleBuilder
appendAll(java.lang.String columnName, java.lang.Object value)
Appends new values to a given non-frozen collection column.Row
build()
Returns the built row.Row.SimpleBuilder
delete()
Deletes the whole row.Row.SimpleBuilder
delete(java.lang.String columnName)
Removes the value for a given column (creating a tombstone).Row.SimpleBuilder
deletePrevious()
Deletes the whole row with a timestamp that is just before the new data's timestamp, to make sure no expired data remains on the row.Row.SimpleBuilder
noPrimaryKeyLivenessInfo()
Don't include any primary keyLivenessInfo
in the built row.Row.SimpleBuilder
timestamp(long timestamp)
Sets the timestamp to use for the following additions.Row.SimpleBuilder
ttl(int ttl)
Sets the ttl to use for the following additions.
-
-
-
Method Detail
-
timestamp
Row.SimpleBuilder timestamp(long timestamp)
Sets the timestamp to use for the following additions.Note that the for non-compact tables, this method must be called before any column addition for this timestamp to be used for the row
LivenessInfo
.- Parameters:
timestamp
- the timestamp to use for following additions. If that timestamp hasn't been set, the current time in microseconds will be used.- Returns:
- this builder.
-
ttl
Row.SimpleBuilder ttl(int ttl)
Sets the ttl to use for the following additions.Note that the for non-compact tables, this method must be called before any column addition for this ttl to be used for the row
LivenessInfo
.- Parameters:
ttl
- the ttl to use for following additions. If that ttl hasn't been set, no ttl will be used.- Returns:
- this builder.
-
add
Row.SimpleBuilder add(java.lang.String columnName, java.lang.Object value)
Adds a value to a given column.- Parameters:
columnName
- the name of the column for which to add a new value.value
- the value to add, which must be of the proper type forcolumnName
. This can benull
in which case the this is equivalent todelete(columnName)
.- Returns:
- this builder.
-
appendAll
Row.SimpleBuilder appendAll(java.lang.String columnName, java.lang.Object value)
Appends new values to a given non-frozen collection column.This method is similar to
add()
but the collection elements added through this method are "appended" to any pre-exising elements. In other words, this is likeadd()
except that it doesn't delete the previous value of the collection. This can only be called on non-frozen collection columns.Note that this method can be used in replacement of
add()
if you know that there can't be any pre-existing value for that column, in which case this is slightly less expensive as it avoid the collection tombstone inherent toadd()
.- Parameters:
columnName
- the name of the column for which to add a new value, which must be a non-frozen collection.value
- the value to add, which must be of the proper type forcolumnName
(in other words, it must be a collection).- Returns:
- this builder.
- Throws:
java.lang.IllegalArgumentException
- if columnName is not a non-frozen collection column.
-
delete
Row.SimpleBuilder delete()
Deletes the whole row.If called, this is generally the only method called on the builder (outside of
timestamp()
.- Returns:
- this builder.
-
deletePrevious
Row.SimpleBuilder deletePrevious()
Deletes the whole row with a timestamp that is just before the new data's timestamp, to make sure no expired data remains on the row.- Returns:
- this builder.
-
delete
Row.SimpleBuilder delete(java.lang.String columnName)
Removes the value for a given column (creating a tombstone).- Parameters:
columnName
- the name of the column to delete.- Returns:
- this builder.
-
noPrimaryKeyLivenessInfo
Row.SimpleBuilder noPrimaryKeyLivenessInfo()
Don't include any primary keyLivenessInfo
in the built row.- Returns:
- this builder.
-
build
Row build()
Returns the built row.- Returns:
- the built row.
-
-