Interface InventoryTransactionResult
-
- All Known Subinterfaces:
InventoryTransactionResult.Poll
public interface InventoryTransactionResultAn interface for data returned by inventory operations which encapsulates the result of an attempted operation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceInventoryTransactionResult.Builderstatic interfaceInventoryTransactionResult.PollThe InventoryTransactionResult for a singleInventory.poll()operation.static classInventoryTransactionResult.TypeThe type of InventoryTransactionResult.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description InventoryTransactionResultand(InventoryTransactionResult other)Combines two transaction-results into one.static InventoryTransactionResult.Builderbuilder()Begin building a new InventoryTransactionResult.static InventoryTransactionResultfailNoTransactions()Returns a builder which indicates that the transaction failed, and the transaction result was no-op.List<ItemStackSnapshot>polledItems()Returns the items polled by the operation.List<ItemStackSnapshot>rejectedItems()Returns items that were supplied to the operation but rejected by the inventory.voidrevert()Reverts all SlotTransactions from this transaction-resultbooleanrevertOnFailure()Reverts all SlotTransactions from this transaction-result if it was aInventoryTransactionResult.Type.FAILUREList<SlotTransaction>slotTransactions()Returns theSlotTransactions that were executed by the operation.static InventoryTransactionResultsuccessNoTransactions()Returns a builder which indicates that the transaction succeeded, but the transaction result was no-op.InventoryTransactionResult.Typetype()Gets the type of result.
-
-
-
Method Detail
-
builder
static InventoryTransactionResult.Builder builder()
Begin building a new InventoryTransactionResult.- Returns:
- A new builder
-
successNoTransactions
static InventoryTransactionResult successNoTransactions()
Returns a builder which indicates that the transaction succeeded, but the transaction result was no-op.- Returns:
- A new transaction result
-
failNoTransactions
static InventoryTransactionResult failNoTransactions()
Returns a builder which indicates that the transaction failed, and the transaction result was no-op.- Returns:
- A new transaction result
-
and
InventoryTransactionResult and(InventoryTransactionResult other)
Combines two transaction-results into one. All slot-transactions, rejected and polled items are combined. The resulting type is the first of this list to occur:InventoryTransactionResult.Type.ERROR,InventoryTransactionResult.Type.FAILURE,InventoryTransactionResult.Type.NO_SLOT,InventoryTransactionResult.Type.SUCCESS- Parameters:
other- The other transaction-result.- Returns:
- The combined transaction-result.
-
revert
void revert()
Reverts all SlotTransactions from this transaction-result
-
revertOnFailure
boolean revertOnFailure()
Reverts all SlotTransactions from this transaction-result if it was aInventoryTransactionResult.Type.FAILURE- Returns:
- true when the transactions were reverted.
-
type
InventoryTransactionResult.Type type()
Gets the type of result.- Returns:
- the type of result
-
rejectedItems
List<ItemStackSnapshot> rejectedItems()
Returns items that were supplied to the operation but rejected by the inventory.- Returns:
- the items which were rejected by the inventory.
-
polledItems
List<ItemStackSnapshot> polledItems()
Returns the items polled by the operation.- Returns:
- the items which were polled from the inventory.
-
slotTransactions
List<SlotTransaction> slotTransactions()
Returns theSlotTransactions that were executed by the operation.- Returns:
- the slot-transactions caused by the inventory operation
-
-