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().
Properties
getId()- Unique transaction identifiergetOperations()- All executed operations in ordergetStartTime()/getCommitTime()- Timing metadatagetTotalAmount()- Sum of all operation amounts
- Since:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classDefault implementation of TransactionResult. -
Method Summary
Modifier and TypeMethodDescriptionGets the instant when the transaction was committed.getId()Gets the unique identifier for this transaction.intGets the number of operations executed in this transaction.Gets all operations executed in this transaction in execution order.getOperationsFor(UUID accountId) Gets all operations that affected the specified account.Gets the instant when the transaction was created.getState()Gets the final state of the transaction.Gets 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
Gets the unique identifier for this transaction.- Returns:
- the transaction UUID
-
getOperations
Gets all operations executed in this transaction in execution order.The returned list is unmodifiable.
- Returns:
- immutable list of operations
-
getOperationCount
@AvailableSince("1.0") int getOperationCount()Gets the number of operations executed in this transaction.- Returns:
- operation count
-
getTotalAmount
Gets the sum of all operation amounts.This aggregates amounts from all operations regardless of type or direction.
- Returns:
- total transaction amount
-
getOperationsFor
Gets 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
Gets the final state of the transaction.Always
Transaction.State.COMMITTEDfor results returned from successful commits.- Returns:
- the transaction state
-
getStartTime
Gets the instant when the transaction was created.- Returns:
- transaction start timestamp
-
getCommitTime
Gets the instant when the transaction was committed.- Returns:
- transaction commit timestamp
-
of
@AvailableSince("1.0") 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
-