Interface TableOperationFactory


public interface TableOperationFactory
A factory to create operations that can be batched for execution by TableAPI.execute.

Each operation created here operates on a single row and matches the corresponding operation defined in TableAPI. For example, the Operation generated by the createPut method corresponds to the put method. The argument pattern for creating the operation is similar. It differs in the following respects:

  • The writeOptions argument is not passed, since that argument applies to the execution of the entire batch of operations and is passed in to the execute method.
  • ReturnRow.Choice is passed instead of ReturnRow.
  • An additional argument, abortIfUnsuccessful is passed.

The return values associated with operations similarly match the descriptions for the corresponding methods described in in TableAPI. They are, however, retrieved differently: the status, return value, previous value and version are packaged together in TableOperationResult.

Since:
3.0
  • Method Details

    • createPut

      TableOperation createPut(Row row, ReturnRow.Choice prevReturn, boolean abortIfUnsuccessful)
      Create a Put operation suitable for use as an argument to the execute method. The semantics of the returned operation are identical to that of the put method.

      The result of evaluating the operation, or the resulting exception, after the call to execute is available as an TableOperationResult.

      Parameters:
      abortIfUnsuccessful - is true if this operation should cause the execute transaction to abort when the operation fails, where failure is the condition when the put method returns null.
      Returns:
      the created Put operation
      See Also:
    • createPutIfAbsent

      TableOperation createPutIfAbsent(Row row, ReturnRow.Choice prevReturn, boolean abortIfUnsuccessful)
      Create a Put operation suitable for use as an argument to the execute method. The semantics of the returned operation are identical to that of the putIfAbsent method.

      The result of evaluating the operation, or the resulting exception, after the call to execute is available as an TableOperationResult.

      Parameters:
      abortIfUnsuccessful - is true if this operation should cause the execute transaction to abort when the operation fails, where failure is the condition when the put method returns null.
      Returns:
      the created Put operation
      See Also:
    • createPutIfPresent

      TableOperation createPutIfPresent(Row row, ReturnRow.Choice prevReturn, boolean abortIfUnsuccessful)
      Create a Put operation suitable for use as an argument to the execute method. The semantics of the returned operation are identical to that of the putIfPresent method.

      The result of evaluating the operation, or the resulting exception, after the call to execute is available as an TableOperationResult.

      Parameters:
      abortIfUnsuccessful - is true if this operation should cause the execute transaction to abort when the operation fails, where failure is the condition when the put method returns null.
      Returns:
      the created Put operation
      See Also:
    • createPutIfVersion

      TableOperation createPutIfVersion(Row row, Version versionMatch, ReturnRow.Choice prevReturn, boolean abortIfUnsuccessful)
      Create a Put operation suitable for use as an argument to the execute method. The semantics of the returned operation are identical to that of the putIfVersion method.

      The result of evaluating the operation, or the resulting exception, after the call to execute is available as an TableOperationResult.

      Parameters:
      abortIfUnsuccessful - is true if this operation should cause the execute transaction to abort when the operation fails, where failure is the condition when the put method returns null.
      Returns:
      the created Put operation
      See Also:
    • createDelete

      TableOperation createDelete(PrimaryKey key, ReturnRow.Choice prevReturn, boolean abortIfUnsuccessful)
      Create a Delete operation suitable for use as an argument to the execute method. The semantics of the returned operation are identical to that of the delete method.

      The result of evaluating the operation, or the resulting exception, after the call to execute is available as an TableOperationResult.

      Parameters:
      abortIfUnsuccessful - is true if this operation should cause the execute transaction to abort when the operation fails, where failure is the condition when the delete method returns null.
      Returns:
      the created Delete operation
      See Also:
    • createDeleteIfVersion

      TableOperation createDeleteIfVersion(PrimaryKey key, Version versionMatch, ReturnRow.Choice prevReturn, boolean abortIfUnsuccessful)
      Create a Delete operation suitable for use as an argument to the execute method. The semantics of the returned operation are identical to that of the deleteIfVersion method.

      The result of evaluating the operation, or the resulting exception, after the call to execute is available as an TableOperationResult.

      Parameters:
      abortIfUnsuccessful - is true if this operation should cause the execute transaction to abort when the operation fails, where failure is the condition when the deleteIfVersion method returns null.
      Returns:
      the created Delete operation
      See Also: