@ThreadSafe public abstract class Transaction<S,R> extends Object
Transactions
, and the callback which is executed for the transaction to occurModifier and Type | Class and Description |
---|---|
static class |
Transaction.Type
The transaction type
|
Constructor and Description |
---|
Transaction(Object item,
S sender,
R receiver,
int amount)
Provides the construction support for transactions
|
Modifier and Type | Method and Description |
---|---|
int |
amount()
The amount of this transaction, always supposed to be positive.
|
abstract void |
doTransaction(Transaction.Type type)
The callback after the transaction completes.
|
Object |
item()
The item type being transacted
|
static <S,R> Transaction<S,R> |
quietTransaction(Object item,
S sender,
R receiver,
int amount)
Creates a new transaction that does not have a callback
|
R |
receiver()
The receiver of the transaction
|
S |
sender()
The sender of the transaction
|
public Transaction(Object item, S sender, R receiver, int amount)
item
- the item type to transactsender
- the sender of the transaction. The person being withdrawn from in a withdrawl.receiver
- the receiver of the transactionamount
- the amount to operate uponpublic static <S,R> Transaction<S,R> quietTransaction(Object item, S sender, R receiver, int amount)
item
- the item type to transactsender
- the sender of the transaction. The person being withdrawn from in a withdrawl.receiver
- the receiver of the transactionamount
- the amount to operate upon. Do not make negative for withdrawls.public abstract void doTransaction(Transaction.Type type)
type
- the type of transaction occuringpublic int amount()
This returns the absolute value of the amount, in case a withdrawl is thought to have a negative number.
Copyright © 2016. All rights reserved.