Interface InventoryTransactionResult
- All Known Subinterfaces:
InventoryTransactionResult.Poll
public interface InventoryTransactionResult
An interface for data returned by inventory operations which encapsulates the
result of an attempted operation.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
static interface
The InventoryTransactionResult for a singleInventory.poll()
operation.static enum
The type of InventoryTransactionResult. -
Method Summary
Modifier and TypeMethodDescriptionand
(InventoryTransactionResult other) Combines two transaction-results into one.builder()
Begin building a new InventoryTransactionResult.static InventoryTransactionResult
Returns a builder which indicates that the transaction failed, and the transaction result was no-op.Returns the items polled by the operation.Returns items that were supplied to the operation but rejected by the inventory.void
revert()
Reverts all SlotTransactions from this transaction-resultboolean
Reverts all SlotTransactions from this transaction-result if it was aInventoryTransactionResult.Type.FAILURE
Returns theSlotTransaction
s that were executed by the operation.static InventoryTransactionResult
Returns a builder which indicates that the transaction succeeded, but the transaction result was no-op.type()
Gets the type of result.
-
Method Details
-
builder
Begin building a new InventoryTransactionResult.- Returns:
- A new builder
-
successNoTransactions
Returns a builder which indicates that the transaction succeeded, but the transaction result was no-op.- Returns:
- A new transaction result
-
failNoTransactions
Returns a builder which indicates that the transaction failed, and the transaction result was no-op.- Returns:
- A new transaction result
-
and
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
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 theSlotTransaction
s that were executed by the operation.- Returns:
- the slot-transactions caused by the inventory operation
-