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
Nested Classes Modifier and Type Interface Description static interface
InventoryTransactionResult.Builder
static interface
InventoryTransactionResult.Poll
The InventoryTransactionResult for a singleInventory.poll()
operation.static class
InventoryTransactionResult.Type
The type of InventoryTransactionResult.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description InventoryTransactionResult
and(InventoryTransactionResult other)
Combines two transaction-results into one.static InventoryTransactionResult.Builder
builder()
Begin building a new InventoryTransactionResult.static InventoryTransactionResult
failNoTransactions()
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.void
revert()
Reverts all SlotTransactions from this transaction-resultboolean
revertOnFailure()
Reverts all SlotTransactions from this transaction-result if it was aInventoryTransactionResult.Type.FAILURE
List<SlotTransaction>
slotTransactions()
Returns theSlotTransaction
s that were executed by the operation.static InventoryTransactionResult
successNoTransactions()
Returns a builder which indicates that the transaction succeeded, but the transaction result was no-op.InventoryTransactionResult.Type
type()
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 theSlotTransaction
s that were executed by the operation.- Returns:
- the slot-transactions caused by the inventory operation
-
-