Class ConditionalRowMutation (2.44.0)

public final class ConditionalRowMutation implements Serializable

Mutates a row atomically based on the output of a condition filter.

Inheritance

java.lang.Object > ConditionalRowMutation

Implements

Serializable

Static Methods

create(TargetId targetId, ByteString rowKey)

public static ConditionalRowMutation create(TargetId targetId, ByteString rowKey)

Creates a new instance of the mutation builder for the given target with targetId. See Also: TableId, AuthorizedViewId

Parameters
Name Description
targetId TargetId
rowKey ByteString
Returns
Type Description
ConditionalRowMutation

create(TargetId targetId, String rowKey)

public static ConditionalRowMutation create(TargetId targetId, String rowKey)

Creates a new instance of the mutation builder for the given target with targetId. See Also: TableId, AuthorizedViewId

Parameters
Name Description
targetId TargetId
rowKey String
Returns
Type Description
ConditionalRowMutation

create(String tableId, ByteString rowKey) (deprecated)

public static ConditionalRowMutation create(String tableId, ByteString rowKey)
Parameters
Name Description
tableId String
rowKey ByteString
Returns
Type Description
ConditionalRowMutation

create(String tableId, String rowKey) (deprecated)

public static ConditionalRowMutation create(String tableId, String rowKey)

Deprecated. Please use ConditionalRowMutation#create(TargetId, String) instead.

Parameters
Name Description
tableId String
rowKey String
Returns
Type Description
ConditionalRowMutation

fromProto(CheckAndMutateRowRequest request)

public static ConditionalRowMutation fromProto(CheckAndMutateRowRequest request)

Wraps the protobuf CheckAndMutateRowRequest.

WARNING: Please note that the table_name will be overwritten by the configuration in the BigtableDataClient.

Parameter
Name Description
request com.google.bigtable.v2.CheckAndMutateRowRequest
Returns
Type Description
ConditionalRowMutation

Methods

condition(Filters.Filter condition)

public ConditionalRowMutation condition(Filters.Filter condition)

The filter to be applied to the contents of the specified row. Depending on whether or not any results are yielded, either the mutations added via #then(Mutation) or #otherwise(Mutation) will be executed. If unset, checks that the row contains any values at all.

Unlike #then(Mutation) and #otherwise(Mutation), only a single condition can be set. However that filter can be a Filters#chain() or Filters#interleave(), which can wrap multiple other filters.

WARNING: Filters#condition(Filter) is not supported.

Parameter
Name Description
condition Filters.Filter
Returns
Type Description
ConditionalRowMutation

otherwise(Mutation mutation)

public ConditionalRowMutation otherwise(Mutation mutation)

Adds changes to be atomically applied to the specified row if the condition does not yields any cells when applied to the row.

Each mutation can specify multiple changes and the changes are accumulated each time this method is called. Mutations are applied in order, meaning that earlier mutations can be masked by later ones. Must contain at least one entry if #then(Mutation) is empty, and at most 100000.

Parameter
Name Description
mutation Mutation
Returns
Type Description
ConditionalRowMutation

then(Mutation mutation)

public ConditionalRowMutation then(Mutation mutation)

Adds changes to be atomically applied to the specified row if the condition yields at least one cell when applied to the row.

Each mutation can specify multiple changes and the changes are accumulated each time this method is called. Mutations are applied in order, meaning that earlier mutations can be masked by later ones. Must contain at least one entry if #otherwise(Mutation) is empty, and at most 100000.

Parameter
Name Description
mutation Mutation
Returns
Type Description
ConditionalRowMutation

toProto(RequestContext requestContext)

public CheckAndMutateRowRequest toProto(RequestContext requestContext)

Creates the underlying CheckAndMutateRowRequest protobuf.

This method is considered an internal implementation detail and not meant to be used by applications.

Parameter
Name Description
requestContext com.google.cloud.bigtable.data.v2.internal.RequestContext
Returns
Type Description
com.google.bigtable.v2.CheckAndMutateRowRequest