Record Class EconomyResult
java.lang.Object
java.lang.Record
fr.mathildeuh.youneedme.api.economy.EconomyResult
public record EconomyResult(EconomyResult.Status status, double balanceAfter, @Nullable String message)
extends Record
Outcome of a single economy operation, mirroring Vault's own success/failure-with-reason shape.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionEconomyResult(EconomyResult.Status status, double balanceAfter, @Nullable String message) Creates an instance of aEconomyResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the value of thebalanceAfterrecord component.final booleanIndicates whether some other object is "equal to" this one.static EconomyResultfailure(EconomyResult.Status status, double currentBalance, String message) final inthashCode()Returns a hash code value for this object.boolean@Nullable Stringmessage()Returns the value of themessagerecord component.status()Returns the value of thestatusrecord component.static EconomyResultsuccess(double balanceAfter) final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
EconomyResult
public EconomyResult(EconomyResult.Status status, double balanceAfter, @Nullable @Nullable String message) Creates an instance of aEconomyResultrecord class.- Parameters:
status- the value for thestatusrecord componentbalanceAfter- the value for thebalanceAfterrecord componentmessage- the value for themessagerecord component
-
-
Method Details
-
success
-
failure
public static EconomyResult failure(EconomyResult.Status status, double currentBalance, String message) -
isSuccess
public boolean isSuccess() -
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
-
balanceAfter
public double balanceAfter()Returns the value of thebalanceAfterrecord component.- Returns:
- the value of the
balanceAfterrecord component
-
message
Returns the value of themessagerecord component.- Returns:
- the value of the
messagerecord component
-