Interface TransactionResult

All Known Implementing Classes:
TransactionResult.Impl

@AvailableSince("1.0") public interface TransactionResult
Immutable audit record of a committed transaction.

Contains all executed operations, timing metadata, and transaction state. Instances are always in Transaction.State.COMMITTED state when returned from Transaction.commit().

Since:
1.0
  • Method Details

    • getId

      UUID getId()
      Returns the unique identifier for this transaction.
      Returns:
      the transaction UUID
    • getOperations

      List<TransactionOperation> getOperations()
      Returns all operations executed in this transaction in execution order.

      The returned list is unmodifiable.

      Returns:
      immutable list of operations
    • getOperationCount

      int getOperationCount()
      Returns the number of operations executed in this transaction.
      Returns:
      operation count
    • getTotalAmount

      BigDecimal getTotalAmount()
      Returns the sum of all operation amounts.

      This aggregates amounts from all operations regardless of type or direction.

      Returns:
      total transaction amount
    • getOperationsFor

      List<TransactionOperation> getOperationsFor(UUID accountId)
      Returns all operations that affected the specified account.

      Filters operations where TransactionOperation.accountId() matches the parameter.

      Parameters:
      accountId - the account identifier to filter by
      Returns:
      list of operations for the account (may be empty)
    • getState

      Transaction.State getState()
      Returns the final state of the transaction.

      Always Transaction.State.COMMITTED for results returned from successful commits.

      Returns:
      the transaction state
    • getStartTime

      Instant getStartTime()
      Returns the instant when the transaction was created.
      Returns:
      transaction start timestamp
    • getCommitTime

      Instant getCommitTime()
      Returns the instant when the transaction was committed.
      Returns:
      transaction commit timestamp
    • of

      static TransactionResult of(UUID id, List<TransactionOperation> operations, Transaction.State state, Instant startTime, Instant commitTime)
      Factory method to create a transaction result.

      Typically used by implementors, not by API consumers.

      Parameters:
      id - transaction identifier
      operations - list of operations (will be copied to unmodifiable list)
      state - final transaction state
      startTime - transaction creation timestamp
      commitTime - transaction commit timestamp
      Returns:
      new transaction result instance