Package net.okocraft.box.api.transaction
Class StockHolderTransaction
java.lang.Object
net.okocraft.box.api.transaction.StockHolderTransaction
A utility class for transacting items between
StockHolder and Inventory.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAn interface to deposit items toStockHolder.static interfaceAn interface to withdraw items fromStockHolder. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull StockHolderTransactioncreate(@NotNull StockHolder stockHolder) Creates aStockHolderTransaction.@NotNull StockHolderTransaction.DepositCreates aStockHolderTransaction.Depositinstance that depositing the specifiedBoxItem.@NotNull StockHolderTransaction.DepositCreates aStockHolderTransaction.Depositinstance that depositing all items that can be deposited.@NotNull StockHolderTransaction.DepositdepositAll(@NotNull Predicate<BoxItem> filter) Creates aStockHolderTransaction.Depositinstance that depositing filtered items that can be deposited.@NotNull StockHolderTransaction.WithdrawalCreates aStockHolderTransaction.Withdrawalinstance that withdrawing the specifiedBoxItem.
-
Method Details
-
create
@Contract("_ -> new") @NotNull public static @NotNull StockHolderTransaction create(@NotNull @NotNull StockHolder stockHolder) Creates aStockHolderTransaction.- Parameters:
stockHolder- aStockHolderto transact- Returns:
- a new
StockHolderTransaction - Throws:
NullPointerException- ifstockHolderis null
-
deposit
@NotNull public @NotNull StockHolderTransaction.Deposit deposit(@NotNull @NotNull BoxItem item, int limit) Creates aStockHolderTransaction.Depositinstance that depositing the specifiedBoxItem.- Parameters:
item- aBoxItemto deposit to theStockHolderlimit- a maximum amount to deposit- Returns:
- a
StockHolderTransaction.Depositinstance - Throws:
NullPointerException- ifitemis null
-
depositAll
Creates aStockHolderTransaction.Depositinstance that depositing all items that can be deposited.- Returns:
- a
StockHolderTransaction.Depositinstance
-
depositAll
@NotNull public @NotNull StockHolderTransaction.Deposit depositAll(@NotNull @NotNull Predicate<BoxItem> filter) Creates aStockHolderTransaction.Depositinstance that depositing filtered items that can be deposited.- Parameters:
filter- aPredicateto filterBoxItems- Returns:
- a
StockHolderTransaction.Depositinstance - Throws:
NullPointerException- iffilteris null
-
withdraw
@NotNull public @NotNull StockHolderTransaction.Withdrawal withdraw(@NotNull @NotNull BoxItem item, int limit) Creates aStockHolderTransaction.Withdrawalinstance that withdrawing the specifiedBoxItem.- Parameters:
item- aBoxItemto withdraw from theStockHolderlimit- a maximum amount to withdraw- Returns:
- a
StockHolderTransaction.Withdrawalinstance - Throws:
NullPointerException- ifitemis null
-