Record Class TransactionResult
java.lang.Object
java.lang.Record
dev.yowsef.stealablock.api.result.TransactionResult
public record TransactionResult(@NotNull TransactionResult.Status status, double previousBalance, double newBalance, double delta, @Nullable String message)
extends Record
Outcome of a money or credits transaction.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionTransactionResult(@NotNull TransactionResult.Status status, double previousBalance, double newBalance, double delta, @Nullable String message) Creates an instance of aTransactionResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoubledelta()Returns the value of thedeltarecord component.final booleanIndicates whether some other object is "equal to" this one.static @NotNull TransactionResultfail(@NotNull TransactionResult.Status status, double current, @Nullable String message) final inthashCode()Returns a hash code value for this object.@Nullable Stringmessage()Returns the value of themessagerecord component.doubleReturns the value of thenewBalancerecord component.static @NotNull TransactionResultok(double previous, double current, double delta) doubleReturns the value of thepreviousBalancerecord component.@NotNull TransactionResult.Statusstatus()Returns the value of thestatusrecord component.booleansuccess()final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
TransactionResult
public TransactionResult(@NotNull @NotNull TransactionResult.Status status, double previousBalance, double newBalance, double delta, @Nullable @Nullable String message) Creates an instance of aTransactionResultrecord class.- Parameters:
status- the value for thestatusrecord componentpreviousBalance- the value for thepreviousBalancerecord componentnewBalance- the value for thenewBalancerecord componentdelta- the value for thedeltarecord componentmessage- the value for themessagerecord component
-
-
Method Details
-
success
public boolean success() -
ok
-
fail
@NotNull public static @NotNull TransactionResult fail(@NotNull @NotNull TransactionResult.Status status, double current, @Nullable @Nullable String message) -
toString
-
hashCode
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
status
Returns the value of thestatusrecord component.- Returns:
- the value of the
statusrecord component
-
previousBalance
public double previousBalance()Returns the value of thepreviousBalancerecord component.- Returns:
- the value of the
previousBalancerecord component
-
newBalance
public double newBalance()Returns the value of thenewBalancerecord component.- Returns:
- the value of the
newBalancerecord component
-
delta
public double delta()Returns the value of thedeltarecord component.- Returns:
- the value of the
deltarecord component
-
message
Returns the value of themessagerecord component.- Returns:
- the value of the
messagerecord component
-