Package dev.mintychochip.mint
Record Class TransactionOperation
java.lang.Object
java.lang.Record
dev.mintychochip.mint.TransactionOperation
@AvailableSince("1.0")
public record TransactionOperation(UUID accountId, Optional<UUID> relatedAccountId, TransactionOperation.Type type, BigDecimal amount, BigDecimal balanceBefore, BigDecimal balanceAfter)
extends Record
Immutable record of a single operation executed within a transaction.
Each operation captures the complete state change including the affected account, operation type, amount, and balance deltas.
Properties
accountId()- The primary account affectedrelatedAccountId()- Secondary account for transferstype()- The operation category (DEPOSIT, WITHDRAW, etc.)amount()- The amount changedbalanceBefore()/balanceAfter()- Balance snapshots
- Since:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumTypes of transaction operations. -
Constructor Summary
ConstructorsConstructorDescriptionTransactionOperation(UUID accountId, Optional<UUID> relatedAccountId, TransactionOperation.Type type, BigDecimal amount, BigDecimal balanceBefore, BigDecimal balanceAfter) Creates an instance of aTransactionOperationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionGets the primary account affected by this operation.amount()Gets the amount changed by this operation.Gets the account balance after this operation executed.Gets the account balance before this operation executed.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Gets the secondary account for transfer operations.final StringtoString()Returns a string representation of this record class.type()Gets the category of operation performed.
-
Constructor Details
-
TransactionOperation
public TransactionOperation(UUID accountId, Optional<UUID> relatedAccountId, TransactionOperation.Type type, BigDecimal amount, BigDecimal balanceBefore, BigDecimal balanceAfter) Creates an instance of aTransactionOperationrecord class.- Parameters:
accountId- the value for theaccountIdrecord componentrelatedAccountId- the value for therelatedAccountIdrecord componenttype- the value for thetyperecord componentamount- the value for theamountrecord componentbalanceBefore- the value for thebalanceBeforerecord componentbalanceAfter- the value for thebalanceAfterrecord component
-
-
Method Details
-
accountId
Gets the primary account affected by this operation.- Returns:
- the account UUID
-
type
Gets the category of operation performed.- Returns:
- the operation type
-
amount
Gets the amount changed by this operation.- Returns:
- the operation amount
-
balanceBefore
Gets the account balance before this operation executed.- Returns:
- the balance before
-
balanceAfter
Gets the account balance after this operation executed.- Returns:
- the balance after
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object).
-