mirror of
https://github.com/SimplexDevelopment/FreedomNetworkSuite.git
synced 2025-06-26 19:44:27 +00:00
Add mutable & immutable transaction interfaces and implementations, replacing copy()
This commit is contained in:
@ -1,8 +1,7 @@
|
||||
package me.totalfreedom.economy;
|
||||
|
||||
public interface CompletedTransaction
|
||||
public interface CompletedTransaction extends Transaction
|
||||
{
|
||||
Transaction getTransaction();
|
||||
|
||||
TransactionResult getResult();
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
package me.totalfreedom.economy;
|
||||
|
||||
/**
|
||||
* Please ensure that all modifications of {@link MutableTransaction} happen BEFORE it is passed to a {@link Transactor} implementation
|
||||
*/
|
||||
public interface MutableTransaction extends Transaction
|
||||
{
|
||||
long addToBalance(final long amount);
|
||||
|
||||
long removeFromBalance(final long amount);
|
||||
|
||||
void setBalance(final long newBalance);
|
||||
}
|
@ -2,17 +2,10 @@ package me.totalfreedom.economy;
|
||||
|
||||
public interface Transaction
|
||||
{
|
||||
Transaction copy();
|
||||
|
||||
EconomicEntity getSource();
|
||||
|
||||
EconomicEntity getDestination();
|
||||
|
||||
long getBalance();
|
||||
|
||||
long addToBalance(final long amount);
|
||||
|
||||
long removeFromBalance(final long amount);
|
||||
|
||||
void setBalance(final long newBalance);
|
||||
}
|
||||
|
@ -2,5 +2,5 @@ package me.totalfreedom.economy;
|
||||
|
||||
public interface Transactor
|
||||
{
|
||||
CompletedTransaction handleTransaction(Transaction transaction);
|
||||
CompletedTransaction handleTransaction(MutableTransaction transaction);
|
||||
}
|
||||
|
Reference in New Issue
Block a user