Package dev.mintychochip.mint
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
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionReturns the instant when the transaction was committed.getId()Returns the unique identifier for this transaction.intReturns the number of operations executed in this transaction.Returns all operations executed in this transaction in execution order.getOperationsFor(UUID accountId) Returns all operations that affected the specified account.Returns the instant when the transaction was created.getState()Returns the final state of the transaction.Returns the sum of all operation amounts.static TransactionResultof(UUID id, List<TransactionOperation> operations, Transaction.State state, Instant startTime, Instant commitTime) Factory method to create a transaction result.
-
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
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.COMMITTEDfor 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 identifieroperations- list of operations (will be copied to unmodifiable list)state- final transaction statestartTime- transaction creation timestampcommitTime- transaction commit timestamp- Returns:
- new transaction result instance
-