Package dev.mintychochip.mint
Record Class TransactionOperation
java.lang.Object
java.lang.Record
dev.mintychochip.mint.TransactionOperation
- Record Components:
accountId- the primary account affected by this operation- the secondary account (present for transfers, empty otherwise)type- the category of operation performedamount- the amount changed by this operationbalanceBefore- the account balance before this operation executedbalanceAfter- the account balance after this operation executed
@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.
- 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 TypeMethodDescriptionReturns the value of theaccountIdrecord component.amount()Returns the value of theamountrecord component.Returns the value of thebalanceAfterrecord component.Returns the value of thebalanceBeforerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of therelatedAccountIdrecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
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
-
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). -
accountId
Returns the value of theaccountIdrecord component.- Returns:
- the value of the
accountIdrecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
amount
Returns the value of theamountrecord component.- Returns:
- the value of the
amountrecord component
-
balanceBefore
Returns the value of thebalanceBeforerecord component.- Returns:
- the value of the
balanceBeforerecord component
-
balanceAfter
Returns the value of thebalanceAfterrecord component.- Returns:
- the value of the
balanceAfterrecord component
-